History

Add new files to M4/ directory to be used instead of acinclude.m4.

Erik de Castro Lopo committed 17 years ago

Commit 4eedd1a1 parent 5464b896 files · +229 −434Browse files

Unified · Split

6 files
  1. ChangeLog +5 −0
  2. M4/check_signal.m4 +26 −0
  3. M4/clip_mode.m4 +124 −0
  4. M4/lrint.m4 +37 −0
  5. M4/lrintf.m4 +37 −0
  6. acinclude.m4 +0 −434
ChangeLog+5−0
@@ -1,3 +1,8 @@
12009-04-11 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
2
3 * M4/check_signal.m4 M4/clip_mode.m4 M4/lrint.m4 M4/lrintf.m4
4 New files used instead of acinclude.m4.
5
12009-04-03 Erik de Castro Lopo <erikd AT mega-nerd DOT com>62009-04-03 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
2 7
3 * src/samplerate.h8 * src/samplerate.h
M4/check_signal.m4+26−0
@@ -0,0 +1,26 @@
1dnl @synopsis AC_CHECK_SIGNAL(SIGNAME)
2dnl
3dnl
4dnl @category C
5dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
6dnl @version 1.0 Jul 07 2007
7
8AC_DEFUN([AC_CHECK_SIGNAL],
9[AC_CACHE_CHECK(for $1,
10 ac_cv_signal_$1,
11[
12AC_TRY_LINK([
13#include <signal.h>
14
15], signal($1, SIG_DFL) ;, ac_cv_signal_$1=yes, ac_cv_signal_$1=no)
16
17])
18
19if test "$ac_cv_signal_$1" = yes; then
20 AC_DEFINE(HAVE_$1, 1,
21 [Define if you have signal $1.])
22fi
23])# AC_CHECK_SIGNAL
24
25
26## AC_CHECK_SIGNALS
M4/clip_mode.m4+124−0
@@ -0,0 +1,124 @@
1dnl @synopsis AC_C_CLIP_MODE
2dnl
3dnl Determine the clipping mode when converting float to int.
4dnl @version 1.0 May 17 2003
5dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
6dnl
7dnl Permission to use, copy, modify, distribute, and sell this file for any
8dnl purpose is hereby granted without fee, provided that the above copyright
9dnl and this permission notice appear in all copies. No representations are
10dnl made about the suitability of this software for any purpose. It is
11dnl provided "as is" without express or implied warranty.
12
13
14
15
16
17
18
19dnl Find the clipping mode in the following way:
20dnl 1) If we are not cross compiling test it.
21dnl 2) IF we are cross compiling, assume that clipping isn't done correctly.
22
23AC_DEFUN([AC_C_CLIP_MODE],
24[AC_CACHE_CHECK(processor clipping capabilities,
25 ac_cv_c_clip_type,
26
27# Initialize to unknown
28ac_cv_c_clip_positive=unknown
29ac_cv_c_clip_negative=unknown
30
31
32if 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
90if test $ac_cv_c_clip_positive = yes ; then
91 ac_cv_c_clip_positive=1
92else
93 ac_cv_c_clip_positive=0
94 fi
95
96if test $ac_cv_c_clip_negative = yes ; then
97 ac_cv_c_clip_negative=1
98else
99 ac_cv_c_clip_negative=0
100 fi
101
102[[
103case "$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)# AC_C_CLIP_MODE
123
124
M4/lrint.m4+37−0
@@ -0,0 +1,37 @@
1dnl @synopsis AC_C99_FUNC_LRINT
2dnl
3dnl Check whether C99's lrint function is available.
4dnl @version 1.3 Feb 12 2002
5dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
6dnl
7dnl Permission to use, copy, modify, distribute, and sell this file for any
8dnl purpose is hereby granted without fee, provided that the above copyright
9dnl and this permission notice appear in all copies. No representations are
10dnl made about the suitability of this software for any purpose. It is
11dnl provided "as is" without express or implied warranty.
12dnl
13AC_DEFUN([AC_C99_FUNC_LRINT],
14[AC_CACHE_CHECK(for lrint,
15 ac_cv_c99_lrint,
16[
17lrint_save_CFLAGS=$CFLAGS
18CFLAGS="-lm"
19AC_TRY_LINK([
20#define _ISOC9X_SOURCE 1
21#define _ISOC99_SOURCE 1
22#define __USE_ISOC99 1
23#define __USE_ISOC9X 1
24
25#include <math.h>
26], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no)
27
28CFLAGS=$lrint_save_CFLAGS
29
30])
31
32if test "$ac_cv_c99_lrint" = yes; then
33 AC_DEFINE(HAVE_LRINT, 1,
34 [Define if you have C99's lrint function.])
35fi
36])# AC_C99_FUNC_LRINT
37
M4/lrintf.m4+37−0
@@ -0,0 +1,37 @@
1dnl @synopsis AC_C99_FUNC_LRINTF
2dnl
3dnl Check whether C99's lrintf function is available.
4dnl @version 1.3 Feb 12 2002
5dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
6dnl
7dnl Permission to use, copy, modify, distribute, and sell this file for any
8dnl purpose is hereby granted without fee, provided that the above copyright
9dnl and this permission notice appear in all copies. No representations are
10dnl made about the suitability of this software for any purpose. It is
11dnl provided "as is" without express or implied warranty.
12dnl
13AC_DEFUN([AC_C99_FUNC_LRINTF],
14[AC_CACHE_CHECK(for lrintf,
15 ac_cv_c99_lrintf,
16[
17lrintf_save_CFLAGS=$CFLAGS
18CFLAGS="-lm"
19AC_TRY_LINK([
20#define _ISOC9X_SOURCE 1
21#define _ISOC99_SOURCE 1
22#define __USE_ISOC99 1
23#define __USE_ISOC9X 1
24
25#include <math.h>
26], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no)
27
28CFLAGS=$lrintf_save_CFLAGS
29
30])
31
32if test "$ac_cv_c99_lrintf" = yes; then
33 AC_DEFINE(HAVE_LRINTF, 1,
34 [Define if you have C99's lrintf function.])
35fi
36])# AC_C99_FUNC_LRINTF
37
acinclude.m4+0−434
@@ -1,434 +0,0 @@
1dnl @synopsis AC_C_FIND_ENDIAN
2dnl
3dnl Determine endian-ness of target processor.
4dnl @version 1.1 Mar 03 2002
5dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
6dnl
7dnl Majority written from scratch to replace the standard autoconf macro
8dnl AC_C_BIGENDIAN. Only part remaining from the original it the invocation
9dnl of the AC_TRY_RUN macro.
10dnl
11dnl Permission to use, copy, modify, distribute, and sell this file for any
12dnl purpose is hereby granted without fee, provided that the above copyright
13dnl and this permission notice appear in all copies. No representations are
14dnl made about the suitability of this software for any purpose. It is
15dnl provided "as is" without express or implied warranty.
16
17dnl Find endian-ness in the following way:
18dnl 1) Look in <endian.h>.
19dnl 2) If 1) fails, look in <sys/types.h> and <sys/param.h>.
20dnl 3) If 1) and 2) fails and not cross compiling run a test program.
21dnl 4) If 1) and 2) fails and cross compiling then guess based on target.
22
23AC_DEFUN([AC_C_FIND_ENDIAN],
24[AC_CACHE_CHECK(processor byte ordering,
25 ac_cv_c_byte_order,
26
27# Initialize to unknown
28ac_cv_c_byte_order=unknown
29
30if test x$ac_cv_header_endian_h = xyes ; then
31
32 # First try <endian.h> which should set BYTE_ORDER.
33
34 [AC_TRY_LINK([
35 #include <endian.h>
36 #if BYTE_ORDER != LITTLE_ENDIAN
37 not big endian
38 #endif
39 ], return 0 ;,
40 ac_cv_c_byte_order=little
41 )]
42
43 [AC_TRY_LINK([
44 #include <endian.h>
45 #if BYTE_ORDER != BIG_ENDIAN
46 not big endian
47 #endif
48 ], return 0 ;,
49 ac_cv_c_byte_order=big
50 )]
51
52 fi
53
54if test $ac_cv_c_byte_order = unknown ; then
55
56 [AC_TRY_LINK([
57 #include <sys/types.h>
58 #include <sys/param.h>
59 #if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN
60 bogus endian macros
61 #endif
62 ], return 0 ;,
63
64 [AC_TRY_LINK([
65 #include <sys/types.h>
66 #include <sys/param.h>
67 #if BYTE_ORDER != LITTLE_ENDIAN
68 not big endian
69 #endif
70 ], return 0 ;,
71 ac_cv_c_byte_order=little
72 )]
73
74 [AC_TRY_LINK([
75 #include <sys/types.h>
76 #include <sys/param.h>
77 #if BYTE_ORDER != LITTLE_ENDIAN
78 not big endian
79 #endif
80 ], return 0 ;,
81 ac_cv_c_byte_order=little
82 )]
83
84 )]
85
86 fi
87
88if test $ac_cv_c_byte_order = unknown ; then
89 if test $cross_compiling = yes ; then
90 # This is the last resort. Try to guess the target processor endian-ness
91 # by looking at the target CPU type.
92 [
93 case "$target_cpu" in
94 alpha* | i?86* | mipsel* | ia64*)
95 ac_cv_c_big_endian=0
96 ac_cv_c_little_endian=1
97 ;;
98
99 m68* | mips* | powerpc* | hppa* | sparc*)
100 ac_cv_c_big_endian=1
101 ac_cv_c_little_endian=0
102 ;;
103
104 esac
105 ]
106 else
107 AC_TRY_RUN(
108 [[
109 int main (void)
110 { /* Are we little or big endian? From Harbison&Steele. */
111 union
112 { long l ;
113 char c [sizeof (long)] ;
114 } u ;
115 u.l = 1 ;
116 return (u.c [sizeof (long) - 1] == 1);
117 }
118 ]], , ac_cv_c_byte_order=big,
119 ac_cv_c_byte_order=unknown
120 )
121
122 AC_TRY_RUN(
123 [[int main (void)
124 { /* Are we little or big endian? From Harbison&Steele. */
125 union
126 { long l ;
127 char c [sizeof (long)] ;
128 } u ;
129 u.l = 1 ;
130 return (u.c [0] == 1);
131 }]], , ac_cv_c_byte_order=little,
132 ac_cv_c_byte_order=unknown
133 )
134 fi
135 fi
136
137)
138]
139
140if test $ac_cv_c_byte_order = big ; then
141 ac_cv_c_big_endian=1
142 ac_cv_c_little_endian=0
143elif test $ac_cv_c_byte_order = little ; then
144 ac_cv_c_big_endian=0
145 ac_cv_c_little_endian=1
146else
147 ac_cv_c_big_endian=0
148 ac_cv_c_little_endian=0
149
150 AC_MSG_WARN([[*****************************************************************]])
151 AC_MSG_WARN([[*** Not able to determine endian-ness of target processor. ]])
152 AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in ]])
153 AC_MSG_WARN([[*** src/config.h may need to be hand editied. ]])
154 AC_MSG_WARN([[*****************************************************************]])
155 fi
156
157)# AC_C_FIND_ENDIAN
158
159
160
161
162
163dnl @synopsis AC_C99_FUNC_LRINT
164dnl
165dnl Check whether C99's lrint function is available.
166dnl @version 1.3 Feb 12 2002
167dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
168dnl
169dnl Permission to use, copy, modify, distribute, and sell this file for any
170dnl purpose is hereby granted without fee, provided that the above copyright
171dnl and this permission notice appear in all copies. No representations are
172dnl made about the suitability of this software for any purpose. It is
173dnl provided "as is" without express or implied warranty.
174dnl
175AC_DEFUN([AC_C99_FUNC_LRINT],
176[AC_CACHE_CHECK(for lrint,
177 ac_cv_c99_lrint,
178[
179lrint_save_CFLAGS=$CFLAGS
180CFLAGS="-O2 -lm"
181AC_TRY_LINK([
182#define _ISOC9X_SOURCE 1
183#define _ISOC99_SOURCE 1
184#define __USE_ISOC99 1
185#define __USE_ISOC9X 1
186
187#include <math.h>
188], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no)
189
190CFLAGS=$lrint_save_CFLAGS
191
192])
193
194if test "$ac_cv_c99_lrint" = yes; then
195 AC_DEFINE(HAVE_LRINT, 1,
196 [Define if you have C99's lrint function.])
197fi
198])# AC_C99_FUNC_LRINT
199
200
201
202
203
204dnl @synopsis AC_C99_FUNC_LRINTF
205dnl
206dnl Check whether C99's lrintf function is available.
207dnl @version 1.3 Feb 12 2002
208dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
209dnl
210dnl Permission to use, copy, modify, distribute, and sell this file for any
211dnl purpose is hereby granted without fee, provided that the above copyright
212dnl and this permission notice appear in all copies. No representations are
213dnl made about the suitability of this software for any purpose. It is
214dnl provided "as is" without express or implied warranty.
215dnl
216
217AC_DEFUN([AC_C99_FUNC_LRINTF],
218[AC_CACHE_CHECK(for lrintf,
219 ac_cv_c99_lrintf,
220[
221lrintf_save_CFLAGS=$CFLAGS
222CFLAGS="-O2 -lm"
223AC_TRY_LINK([
224#define _ISOC9X_SOURCE 1
225#define _ISOC99_SOURCE 1
226#define __USE_ISOC99 1
227#define __USE_ISOC9X 1
228
229#include <math.h>
230], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no)
231
232CFLAGS=$lrintf_save_CFLAGS
233
234])
235
236if test "$ac_cv_c99_lrintf" = yes; then
237 AC_DEFINE(HAVE_LRINTF, 1,
238 [Define if you have C99's lrintf function.])
239fi
240])# AC_C99_FUNC_LRINTF
241
242
243
244
245
246dnl @synopsis AC_C99_FUNC_LLRINT
247dnl
248dnl Check whether C99's llrint function is available.
249dnl @version 1.1 Sep 30 2002
250dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
251dnl
252dnl Permission to use, copy, modify, distribute, and sell this file for any
253dnl purpose is hereby granted without fee, provided that the above copyright
254dnl and this permission notice appear in all copies. No representations are
255dnl made about the suitability of this software for any purpose. It is
256dnl provided "as is" without express or implied warranty.
257dnl
258AC_DEFUN([AC_C99_FUNC_LLRINT],
259[AC_CACHE_CHECK(for llrint,
260 ac_cv_c99_llrint,
261[
262llrint_save_CFLAGS=$CFLAGS
263CFLAGS="-O2 -lm"
264AC_TRY_LINK([
265#define _ISOC9X_SOURCE 1
266#define _ISOC99_SOURCE 1
267#define __USE_ISOC99 1
268#define __USE_ISOC9X 1
269
270#include <math.h>
271#include <stdint.h>
272], int64_t x ; x = llrint(3.14159) ;, ac_cv_c99_llrint=yes, ac_cv_c99_llrint=no)
273
274CFLAGS=$llrint_save_CFLAGS
275
276])
277
278if test "$ac_cv_c99_llrint" = yes; then
279 AC_DEFINE(HAVE_LLRINT, 1,
280 [Define if you have C99's llrint function.])
281fi
282])# AC_C99_FUNC_LLRINT
283
284
285
286
287
288dnl @synopsis AC_C_CLIP_MODE
289dnl
290dnl Determine the clipping mode when converting float to int.
291dnl @version 1.0 May 17 2003
292dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
293dnl
294dnl Permission to use, copy, modify, distribute, and sell this file for any
295dnl purpose is hereby granted without fee, provided that the above copyright
296dnl and this permission notice appear in all copies. No representations are
297dnl made about the suitability of this software for any purpose. It is
298dnl provided "as is" without express or implied warranty.
299
300dnl Find the clipping mode in the following way:
301dnl 1) If we are not cross compiling test it.
302dnl 2) IF we are cross compiling, assume that clipping isn't done correctly.
303
304AC_DEFUN([AC_C_CLIP_MODE],
305[AC_CACHE_CHECK(processor clipping capabilities,
306 ac_cv_c_clip_type,
307
308# Initialize to unknown
309ac_cv_c_clip_positive=unknown
310ac_cv_c_clip_negative=unknown
311
312if test $ac_cv_c_clip_positive = unknown ; then
313 AC_TRY_RUN(
314 [[
315 #define _ISOC9X_SOURCE 1
316 #define _ISOC99_SOURCE 1
317 #define __USE_ISOC99 1
318 #define __USE_ISOC9X 1
319 #include <math.h>
320 int main (void)
321 { double fval ;
322 int k, ival ;
323
324 fval = 1.0 * 0x7FFFFFFF ;
325 for (k = 0 ; k < 100 ; k++)
326 { ival = (lrint (fval)) >> 24 ;
327 if (ival != 127)
328 return 1 ;
329
330 fval *= 1.2499999 ;
331 } ;
332
333 return 0 ;
334 }
335 ]],
336 ac_cv_c_clip_positive=yes,
337 ac_cv_c_clip_positive=no,
338 ac_cv_c_clip_positive=unknown
339 )
340
341 AC_TRY_RUN(
342 [[
343 #define _ISOC9X_SOURCE 1
344 #define _ISOC99_SOURCE 1
345 #define __USE_ISOC99 1
346 #define __USE_ISOC9X 1
347 #include <math.h>
348 int main (void)
349 { double fval ;
350 int k, ival ;
351
352 fval = -8.0 * 0x10000000 ;
353 for (k = 0 ; k < 100 ; k++)
354 { ival = (lrint (fval)) >> 24 ;
355 if (ival != -128)
356 return 1 ;
357
358 fval *= 1.2499999 ;
359 } ;
360
361 return 0 ;
362 }
363 ]],
364 ac_cv_c_clip_negative=yes,
365 ac_cv_c_clip_negative=no,
366 ac_cv_c_clip_negative=unknown
367 )
368
369 fi
370
371if test $ac_cv_c_clip_positive = yes ; then
372 ac_cv_c_clip_positive=1
373else
374 ac_cv_c_clip_positive=0
375 fi
376
377if test $ac_cv_c_clip_negative = yes ; then
378 ac_cv_c_clip_negative=1
379else
380 ac_cv_c_clip_negative=0
381 fi
382
383[[
384case "$ac_cv_c_clip_positive$ac_cv_c_clip_negative" in
385 "00")
386 ac_cv_c_clip_type="none"
387 ;;
388 "10")
389 ac_cv_c_clip_type="positive"
390 ;;
391 "01")
392 ac_cv_c_clip_type="negative"
393 ;;
394 "11")
395 ac_cv_c_clip_type="both"
396 ;;
397 esac
398 ]]
399
400)
401]
402
403)# AC_C_CLIP_MODE
404
405
406
407
408
409dnl @synopsis AC_CHECK_SIGNAL(SIGNAME)
410dnl
411dnl
412dnl @category C
413dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
414dnl @version 1.0 Jul 07 2007
415
416AC_DEFUN([AC_CHECK_SIGNAL],
417[AC_CACHE_CHECK(for $1,
418 ac_cv_signal_$1,
419[
420AC_TRY_LINK([
421#include <signal.h>
422
423], signal($1, SIG_DFL) ;, ac_cv_signal_$1=yes, ac_cv_signal_$1=no)
424
425])
426
427if test "$ac_cv_signal_$1" = yes; then
428 AC_DEFINE(HAVE_$1, 1,
429 [Define if you have signal $1.])
430fi
431])# AC_CHECK_SIGNAL
432
433
434## AC_CHECK_SIGNALS

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t