File: ax_c99_features.m4

package info (click to toggle)
spandsp 0.0.6%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 15,796 kB
  • sloc: ansic: 123,211; xml: 13,229; sh: 12,189; cpp: 1,521; makefile: 1,097
file content (181 lines) | stat: -rw-r--r-- 5,208 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# @synopsis AX_C99_FLEXIBLE_ARRAY
#
# Does the compiler support the 1999 ISO C Standard "struct hack".
# @version 1.1    Mar 15 2004
# @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
#
# Permission to use, copy, modify, distribute, and sell this file for any 
# purpose is hereby granted without fee, provided that the above copyright 
# and this permission notice appear in all copies.  No representations are
# made about the suitability of this software for any purpose.  It is 
# provided "as is" without express or implied warranty.

AC_DEFUN([AX_C99_FLEXIBLE_ARRAY],
[AC_CACHE_CHECK(if have C99 struct flexible array support, 
    ac_cv_c99_flexible_array,

# Initialize to unknown
ac_cv_c99_flexible_array=no

AC_TRY_LINK([[
    #include <stdlib.h>

    typedef struct {
    int k;
    char buffer [] ;
    } MY_STRUCT ;
    ]], 
    [  MY_STRUCT *p = calloc (1, sizeof (MY_STRUCT) + 42); ],
    ac_cv_c99_flexible_array=yes,
    ac_cv_c99_flexible_array=no
    ))]
) # AX_C99_FLEXIBLE_ARRAY

# @synopsis AX_C99_FUNC_LRINT
#
# Check whether C99's lrint function is available.
# @version 1.3    Feb 12 2002
# @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
#
# Permission to use, copy, modify, distribute, and sell this file for any 
# purpose is hereby granted without fee, provided that the above copyright 
# and this permission notice appear in all copies.  No representations are
# made about the suitability of this software for any purpose.  It is 
# provided "as is" without express or implied warranty.
#
AC_DEFUN([AX_C99_FUNC_LRINT],
[AC_CACHE_CHECK(for lrint,
  ac_cv_c99_lrint,
[
lrint_save_LIBS=$LIBS
LIBS="-lm"
AC_TRY_LINK([
#define _ISOC9X_SOURCE  1
#define _ISOC99_SOURCE  1
#define __USE_ISOC99    1
#define __USE_ISOC9X    1

#include <math.h>
], if (!lrint(3.14159)) lrint(2.7183);, ac_cv_c99_lrint=yes, ac_cv_c99_lrint=no)

LIBS=$lrint_save_LIBS

])

if test "$ac_cv_c99_lrint" = yes; then
  AC_DEFINE(HAVE_LRINT, 1,
            [Define if you have C99's lrint function.])
fi
])# AX_C99_FUNC_LRINT

# @synopsis AX_C99_FUNC_LRINTF
#
# Check whether C99's lrintf function is available.
# @version 1.3    Feb 12 2002
# @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
#
# Permission to use, copy, modify, distribute, and sell this file for any 
# purpose is hereby granted without fee, provided that the above copyright 
# and this permission notice appear in all copies.  No representations are
# made about the suitability of this software for any purpose.  It is 
# provided "as is" without express or implied warranty.
#
AC_DEFUN([AX_C99_FUNC_LRINTF],
[AC_CACHE_CHECK(for lrintf,
  ac_cv_c99_lrintf,
[
lrintf_save_LIBS=$LIBS
LIBS="-lm"
AC_TRY_LINK([
#define _ISOC9X_SOURCE  1
#define _ISOC99_SOURCE  1
#define __USE_ISOC99    1
#define __USE_ISOC9X    1

#include <math.h>
], if (!lrintf(3.14159)) lrintf(2.7183);, ac_cv_c99_lrintf=yes, ac_cv_c99_lrintf=no)

LIBS=$lrintf_save_LIBS

])

if test "$ac_cv_c99_lrintf" = yes; then
  AC_DEFINE(HAVE_LRINTF, 1,
            [Define if you have C99's lrintf function.])
fi
])# AX_C99_FUNC_LRINTF

# @synopsis AX_C99_FUNC_LLRINT
#
# Check whether C99's llrint function is available.
# @version 1.1    Sep 30 2002
# @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
#
# Permission to use, copy, modify, distribute, and sell this file for any 
# purpose is hereby granted without fee, provided that the above copyright 
# and this permission notice appear in all copies.  No representations are
# made about the suitability of this software for any purpose.  It is 
# provided "as is" without express or implied warranty.
#
AC_DEFUN([AX_C99_FUNC_LLRINT],
[AC_CACHE_CHECK(for llrint,
  ac_cv_c99_llrint,
[
llrint_save_LIBS=$LIBS
LIBS="-lm"
AC_TRY_LINK([
#define ISOC9X_SOURCE   1
#define _ISOC99_SOURCE  1
#define __USE_ISOC99    1
#define __USE_ISOC9X    1

#include <math.h>
], long long int x ; x = llrint(3.14159) ;, ac_cv_c99_llrint=yes, ac_cv_c99_llrint=no)

LIBS=$llrint_save_LIBS

])

if test "$ac_cv_c99_llrint" = yes; then
  AC_DEFINE(HAVE_LLRINT, 1,
            [Define if you have C99's llrint function.])
fi
])# AX_C99_FUNC_LLRINT


# @synopsis AX_C99_FUNC_LLRINTF
#
# Check whether C99's llrintf function is available.
# @version 1.1    Sep 30 2002
# @author Erik de Castro Lopo <erikd AT mega-nerd DOT com>
#
# Permission to use, copy, modify, distribute, and sell this file for any 
# purpose is hereby granted without fee, provided that the above copyright 
# and this permission notice appear in all copies.  No representations are
# made about the suitability of this software for any purpose.  It is 
# provided "as is" without express or implied warranty.
#
AC_DEFUN([AX_C99_FUNC_LLRINTF],
[AC_CACHE_CHECK(for llrintf,
  ac_cv_c99_llrintf,
[
llrintf_save_LIBS=$LIBS
LIBS="-lm"
AC_TRY_LINK([
#define _ISOC9X_SOURCE  1
#define _ISOC99_SOURCE  1
#define __USE_ISOC99    1
#define __USE_ISOC9X    1

#include <math.h>
], long long int x ; x = llrintf(3.14159) ;, ac_cv_c99_llrintf=yes, ac_cv_c99_llrintf=no)

LIBS=$llrintf_save_LIBS

])

if test "$ac_cv_c99_llrintf" = yes; then
  AC_DEFINE(HAVE_LLRINTF, 1,
            [Define if you have C99's llrintf function.])
fi
])# AX_C99_FUNC_LLRINTF