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 @@
1+2009-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+
16 2009-04-03 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
27
38 * src/samplerate.h
M4/check_signal.m4+26−0
@@ -0,0 +1,26 @@
1+dnl @synopsis AC_CHECK_SIGNAL(SIGNAME)
2+dnl
3+dnl
4+dnl @category C
5+dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
6+dnl @version 1.0 Jul 07 2007
7+
8+AC_DEFUN([AC_CHECK_SIGNAL],
9+[AC_CACHE_CHECK(for $1,
10+ ac_cv_signal_$1,
11+[
12+AC_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+
19+if test "$ac_cv_signal_$1" = yes; then
20+ AC_DEFINE(HAVE_$1, 1,
21+ [Define if you have signal $1.])
22+fi
23+])# AC_CHECK_SIGNAL
24+
25+
26+## AC_CHECK_SIGNALS
M4/clip_mode.m4+124−0
@@ -0,0 +1,124 @@
1+dnl @synopsis AC_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([AC_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+)# AC_C_CLIP_MODE
123+
124+
M4/lrint.m4+37−0
@@ -0,0 +1,37 @@
1+dnl @synopsis AC_C99_FUNC_LRINT
2+dnl
3+dnl Check whether C99's lrint function is available.
4+dnl @version 1.3 Feb 12 2002
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+dnl
13+AC_DEFUN([AC_C99_FUNC_LRINT],
14+[AC_CACHE_CHECK(for lrint,
15+ ac_cv_c99_lrint,
16+[
17+lrint_save_CFLAGS=$CFLAGS
18+CFLAGS="-lm"
19+AC_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+
28+CFLAGS=$lrint_save_CFLAGS
29+
30+])
31+
32+if test "$ac_cv_c99_lrint" = yes; then
33+ AC_DEFINE(HAVE_LRINT, 1,
34+ [Define if you have C99's lrint function.])
35+fi
36+])# AC_C99_FUNC_LRINT
37+
M4/lrintf.m4+37−0
@@ -0,0 +1,37 @@
1+dnl @synopsis AC_C99_FUNC_LRINTF
2+dnl
3+dnl Check whether C99's lrintf function is available.
4+dnl @version 1.3 Feb 12 2002
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+dnl
13+AC_DEFUN([AC_C99_FUNC_LRINTF],
14+[AC_CACHE_CHECK(for lrintf,
15+ ac_cv_c99_lrintf,
16+[
17+lrintf_save_CFLAGS=$CFLAGS
18+CFLAGS="-lm"
19+AC_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+
28+CFLAGS=$lrintf_save_CFLAGS
29+
30+])
31+
32+if test "$ac_cv_c99_lrintf" = yes; then
33+ AC_DEFINE(HAVE_LRINTF, 1,
34+ [Define if you have C99's lrintf function.])
35+fi
36+])# AC_C99_FUNC_LRINTF
37+
acinclude.m4+0−434
@@ -1,434 +0,0 @@
1−dnl @synopsis AC_C_FIND_ENDIAN
2−dnl
3−dnl Determine endian-ness of target processor.
4−dnl @version 1.1 Mar 03 2002
5−dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
6−dnl
7−dnl Majority written from scratch to replace the standard autoconf macro
8−dnl AC_C_BIGENDIAN. Only part remaining from the original it the invocation
9−dnl of the AC_TRY_RUN macro.
10−dnl
11−dnl Permission to use, copy, modify, distribute, and sell this file for any
12−dnl purpose is hereby granted without fee, provided that the above copyright
13−dnl and this permission notice appear in all copies. No representations are
14−dnl made about the suitability of this software for any purpose. It is
15−dnl provided "as is" without express or implied warranty.
16−
17−dnl Find endian-ness in the following way:
18−dnl 1) Look in <endian.h>.
19−dnl 2) If 1) fails, look in <sys/types.h> and <sys/param.h>.
20−dnl 3) If 1) and 2) fails and not cross compiling run a test program.
21−dnl 4) If 1) and 2) fails and cross compiling then guess based on target.
22−
23−AC_DEFUN([AC_C_FIND_ENDIAN],
24−[AC_CACHE_CHECK(processor byte ordering,
25− ac_cv_c_byte_order,
26−
27−# Initialize to unknown
28−ac_cv_c_byte_order=unknown
29−
30−if 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−
54−if 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−
88−if 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−
140−if test $ac_cv_c_byte_order = big ; then
141− ac_cv_c_big_endian=1
142− ac_cv_c_little_endian=0
143−elif test $ac_cv_c_byte_order = little ; then
144− ac_cv_c_big_endian=0
145− ac_cv_c_little_endian=1
146−else
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−
163−dnl @synopsis AC_C99_FUNC_LRINT
164−dnl
165−dnl Check whether C99's lrint function is available.
166−dnl @version 1.3 Feb 12 2002
167−dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
168−dnl
169−dnl Permission to use, copy, modify, distribute, and sell this file for any
170−dnl purpose is hereby granted without fee, provided that the above copyright
171−dnl and this permission notice appear in all copies. No representations are
172−dnl made about the suitability of this software for any purpose. It is
173−dnl provided "as is" without express or implied warranty.
174−dnl
175−AC_DEFUN([AC_C99_FUNC_LRINT],
176−[AC_CACHE_CHECK(for lrint,
177− ac_cv_c99_lrint,
178−[
179−lrint_save_CFLAGS=$CFLAGS
180−CFLAGS="-O2 -lm"
181−AC_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−
190−CFLAGS=$lrint_save_CFLAGS
191−
192−])
193−
194−if test "$ac_cv_c99_lrint" = yes; then
195− AC_DEFINE(HAVE_LRINT, 1,
196− [Define if you have C99's lrint function.])
197−fi
198−])# AC_C99_FUNC_LRINT
199−
200−
201−
202−
203−
204−dnl @synopsis AC_C99_FUNC_LRINTF
205−dnl
206−dnl Check whether C99's lrintf function is available.
207−dnl @version 1.3 Feb 12 2002
208−dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
209−dnl
210−dnl Permission to use, copy, modify, distribute, and sell this file for any
211−dnl purpose is hereby granted without fee, provided that the above copyright
212−dnl and this permission notice appear in all copies. No representations are
213−dnl made about the suitability of this software for any purpose. It is
214−dnl provided "as is" without express or implied warranty.
215−dnl
216−
217−AC_DEFUN([AC_C99_FUNC_LRINTF],
218−[AC_CACHE_CHECK(for lrintf,
219− ac_cv_c99_lrintf,
220−[
221−lrintf_save_CFLAGS=$CFLAGS
222−CFLAGS="-O2 -lm"
223−AC_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−
232−CFLAGS=$lrintf_save_CFLAGS
233−
234−])
235−
236−if test "$ac_cv_c99_lrintf" = yes; then
237− AC_DEFINE(HAVE_LRINTF, 1,
238− [Define if you have C99's lrintf function.])
239−fi
240−])# AC_C99_FUNC_LRINTF
241−
242−
243−
244−
245−
246−dnl @synopsis AC_C99_FUNC_LLRINT
247−dnl
248−dnl Check whether C99's llrint function is available.
249−dnl @version 1.1 Sep 30 2002
250−dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
251−dnl
252−dnl Permission to use, copy, modify, distribute, and sell this file for any
253−dnl purpose is hereby granted without fee, provided that the above copyright
254−dnl and this permission notice appear in all copies. No representations are
255−dnl made about the suitability of this software for any purpose. It is
256−dnl provided "as is" without express or implied warranty.
257−dnl
258−AC_DEFUN([AC_C99_FUNC_LLRINT],
259−[AC_CACHE_CHECK(for llrint,
260− ac_cv_c99_llrint,
261−[
262−llrint_save_CFLAGS=$CFLAGS
263−CFLAGS="-O2 -lm"
264−AC_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−
274−CFLAGS=$llrint_save_CFLAGS
275−
276−])
277−
278−if test "$ac_cv_c99_llrint" = yes; then
279− AC_DEFINE(HAVE_LLRINT, 1,
280− [Define if you have C99's llrint function.])
281−fi
282−])# AC_C99_FUNC_LLRINT
283−
284−
285−
286−
287−
288−dnl @synopsis AC_C_CLIP_MODE
289−dnl
290−dnl Determine the clipping mode when converting float to int.
291−dnl @version 1.0 May 17 2003
292−dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
293−dnl
294−dnl Permission to use, copy, modify, distribute, and sell this file for any
295−dnl purpose is hereby granted without fee, provided that the above copyright
296−dnl and this permission notice appear in all copies. No representations are
297−dnl made about the suitability of this software for any purpose. It is
298−dnl provided "as is" without express or implied warranty.
299−
300−dnl Find the clipping mode in the following way:
301−dnl 1) If we are not cross compiling test it.
302−dnl 2) IF we are cross compiling, assume that clipping isn't done correctly.
303−
304−AC_DEFUN([AC_C_CLIP_MODE],
305−[AC_CACHE_CHECK(processor clipping capabilities,
306− ac_cv_c_clip_type,
307−
308−# Initialize to unknown
309−ac_cv_c_clip_positive=unknown
310−ac_cv_c_clip_negative=unknown
311−
312−if 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−
371−if test $ac_cv_c_clip_positive = yes ; then
372− ac_cv_c_clip_positive=1
373−else
374− ac_cv_c_clip_positive=0
375− fi
376−
377−if test $ac_cv_c_clip_negative = yes ; then
378− ac_cv_c_clip_negative=1
379−else
380− ac_cv_c_clip_negative=0
381− fi
382−
383−[[
384−case "$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−
409−dnl @synopsis AC_CHECK_SIGNAL(SIGNAME)
410−dnl
411−dnl
412−dnl @category C
413−dnl @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
414−dnl @version 1.0 Jul 07 2007
415−
416−AC_DEFUN([AC_CHECK_SIGNAL],
417−[AC_CACHE_CHECK(for $1,
418− ac_cv_signal_$1,
419−[
420−AC_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−
427−if test "$ac_cv_signal_$1" = yes; then
428− AC_DEFINE(HAVE_$1, 1,
429− [Define if you have signal $1.])
430−fi
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