Makefiles chain, dependancies and libsndfile configure checked.
[Faustine.git] / interpretor / lib / src / libsndfile-1.0.25 / M4 / clip_mode.m4
1 dnl @synopsis MN_C_CLIP_MODE
2 dnl
3 dnl Determine the clipping mode when converting float to int.
4 dnl @version 1.0 May 17 2003
5 dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
6 dnl
7 dnl Permission to use, copy, modify, distribute, and sell this file for any
8 dnl purpose is hereby granted without fee, provided that the above copyright
9 dnl and this permission notice appear in all copies. No representations are
10 dnl made about the suitability of this software for any purpose. It is
11 dnl provided "as is" without express or implied warranty.
12
13
14
15
16
17
18
19 dnl Find the clipping mode in the following way:
20 dnl 1) If we are not cross compiling test it.
21 dnl 2) IF we are cross compiling, assume that clipping isn't done correctly.
22
23 AC_DEFUN([MN_C_CLIP_MODE],
24 [AC_CACHE_CHECK(processor clipping capabilities,
25 ac_cv_c_clip_type,
26
27 # Initialize to unknown
28 ac_cv_c_clip_positive=unknown
29 ac_cv_c_clip_negative=unknown
30
31
32 if test $ac_cv_c_clip_positive = unknown ; then
33 AC_TRY_RUN(
34 [[
35 #define _ISOC9X_SOURCE 1
36 #define _ISOC99_SOURCE 1
37 #define __USE_ISOC99 1
38 #define __USE_ISOC9X 1
39 #include <math.h>
40 int main (void)
41 { double fval ;
42 int k, ival ;
43
44 fval = 1.0 * 0x7FFFFFFF ;
45 for (k = 0 ; k < 100 ; k++)
46 { ival = (lrint (fval)) >> 24 ;
47 if (ival != 127)
48 return 1 ;
49
50 fval *= 1.2499999 ;
51 } ;
52
53 return 0 ;
54 }
55 ]],
56 ac_cv_c_clip_positive=yes,
57 ac_cv_c_clip_positive=no,
58 ac_cv_c_clip_positive=unknown
59 )
60
61 AC_TRY_RUN(
62 [[
63 #define _ISOC9X_SOURCE 1
64 #define _ISOC99_SOURCE 1
65 #define __USE_ISOC99 1
66 #define __USE_ISOC9X 1
67 #include <math.h>
68 int main (void)
69 { double fval ;
70 int k, ival ;
71
72 fval = -8.0 * 0x10000000 ;
73 for (k = 0 ; k < 100 ; k++)
74 { ival = (lrint (fval)) >> 24 ;
75 if (ival != -128)
76 return 1 ;
77
78 fval *= 1.2499999 ;
79 } ;
80
81 return 0 ;
82 }
83 ]],
84 ac_cv_c_clip_negative=yes,
85 ac_cv_c_clip_negative=no,
86 ac_cv_c_clip_negative=unknown
87 )
88 fi
89
90 if test $ac_cv_c_clip_positive = yes ; then
91 ac_cv_c_clip_positive=1
92 else
93 ac_cv_c_clip_positive=0
94 fi
95
96 if test $ac_cv_c_clip_negative = yes ; then
97 ac_cv_c_clip_negative=1
98 else
99 ac_cv_c_clip_negative=0
100 fi
101
102 [[
103 case "$ac_cv_c_clip_positive$ac_cv_c_clip_negative" in
104 "00")
105 ac_cv_c_clip_type="none"
106 ;;
107 "10")
108 ac_cv_c_clip_type="positive"
109 ;;
110 "01")
111 ac_cv_c_clip_type="negative"
112 ;;
113 "11")
114 ac_cv_c_clip_type="both"
115 ;;
116 esac
117 ]]
118
119 )
120 ]
121
122 )# MN_C_CLIP_MODE
123
124