-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.ac
388 lines (348 loc) · 13.7 KB
/
configure.ac
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
#
# broadvoice - a library for the BroadVoice 16 and 32 codecs
#
# configure.ac -- Process this file with autoconf to produce configure
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
# $Id: configure.ac,v 1.2 2009/11/21 17:19:22 steveu Exp $
# @start 1
AC_INIT([broadvoice],[0.1.0])
CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
m4_include(config/ax_compiler_vendor.m4)
m4_include(config/ax_fixed_point_machine.m4)
m4_include(config/ax_misaligned_access_fails.m4)
m4_include(config/ax_c99_features.m4)
m4_include(config/ax_check_export_capability.m4)
m4_include(config/ax_check_folders.m4)
BROADVOICE_MAJOR_VERSION=0
BROADVOICE_MINOR_VERSION=1
BROADVOICE_MICRO_VERSION=0
BROADVOICE_LT_CURRENT=0
BROADVOICE_LT_REVISION=1
BROADVOICE_LT_AGE=0
VERSION=$BROADVOICE_MAJOR_VERSION.$BROADVOICE_MINOR_VERSION.$BROADVOICE_MICRO_VERSION
PACKAGE=broadvoice
AC_SUBST(BROADVOICE_LT_CURRENT)
AC_SUBST(BROADVOICE_LT_REVISION)
AC_SUBST(BROADVOICE_LT_AGE)
AC_CONFIG_SRCDIR([src/bitpack32.c])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_HEADERS([src/config.h:config-h.in])
AM_INIT_AUTOMAKE
AC_CANONICAL_HOST
#AC_CANONICAL_BUILD
AC_PROG_CC
AC_PROG_CXX
AC_PROG_GCC_TRADITIONAL
AC_PROG_LIBTOOL
AC_LANG([C])
AX_COMPILER_VENDOR
if test "${build}" != "${host}"
then
# If we are doing a Canadian Cross, in which the host and build systems
# are not the same, we set reasonable default values for the tools.
CC_FOR_BUILD=${CC_FOR_BUILD-gcc}
CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)"
CC=${CC-${host_alias}-gcc}
CFLAGS=${CFLAGS-"-g -O2"}
CXX=${CXX-${host_alias}-c++}
CXXFLAGS=${CXXFLAGS-"-g -O2"}
else
# Set reasonable default values for some tools even if not Canadian.
# Of course, these are different reasonable default values, originally
# specified directly in the Makefile.
# We don't export, so that autoconf can do its job.
# Note that all these settings are above the fragment inclusion point
# in Makefile.in, so can still be overridden by fragments.
# This is all going to change when we autoconfiscate...
CC_FOR_BUILD="\$(CC)"
CPPFLAGS_FOR_BUILD="\$(CPPFLAGS)"
AC_PROG_CC
# We must set the default linker to the linker used by gcc for the correct
# operation of libtool. If LD is not defined and we are using gcc, try to
# set the LD default to the ld used by gcc.
if test -z "$LD"
then
if test "$GCC" = yes
then
case $build in
*-*-mingw*)
gcc_prog_ld=`$CC -print-prog-name=ld 2>&1 | tr -d '\015'` ;;
*)
gcc_prog_ld=`$CC -print-prog-name=ld 2>&1` ;;
esac
case $gcc_prog_ld in
# Accept absolute paths.
[[\\/]* | [A-Za-z]:[\\/]*)]
LD="$gcc_prog_ld" ;;
esac
fi
fi
CXX=${CXX-"c++"}
CFLAGS=${CFLAGS-"-g -O2"}
CXXFLAGS=${CXXFLAGS-"-g -O2"}
fi
AC_DEFUN([REMOVE_FROM_VAR],[
new_val=""
removed=0
for i in $$1; do
if test "x$i" != "x$2"; then
new_val="$new_val $i"
else
removed=1
fi
done
if test $removed = "1"; then
echo " removed \"$2\" from $1"
$1=$new_val
fi
])
AC_C_CONST
AC_C_INLINE
AC_C_VOLATILE
AC_CHECK_TYPES(long long)
AC_CHECK_TYPES(long double)
AC_TYPE_SIGNAL
AC_ARG_ENABLE(doc, [ --enable-doc Build the documentation])
AC_ARG_ENABLE(tests, [ --enable-tests Build the test programs])
AC_ARG_ENABLE(mmx, [ --enable-mmx Enable MMX support])
AC_ARG_ENABLE(sse, [ --enable-sse Enable SSE support])
AC_ARG_ENABLE(sse2, [ --enable-sse2 Enable SSE2 support])
AC_ARG_ENABLE(sse3, [ --enable-sse3 Enable SSE3 support])
AC_ARG_ENABLE(sse3, [ --enable-sse3 Enable SSE3 support])
AC_ARG_ENABLE(sse4_1, [ --enable-sse4-1 Enable SSE4.1 support])
AC_ARG_ENABLE(sse4_2, [ --enable-sse4-2 Enable SSE4.2 support])
AC_ARG_ENABLE(sse4a, [ --enable-sse4a Enable SSE4A support])
AC_ARG_ENABLE(sse5, [ --enable-sse5 Enable SSE5 support])
AC_ARG_ENABLE(fixed_point, [ --enable-fixed-point Enable fixed point support])
AC_FUNC_ERROR_AT_LINE
AC_FUNC_VPRINTF
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AX_C99_FUNC_LRINT
AX_C99_FUNC_LRINTF
AX_C99_FUNC_LLRINT
AX_C99_FUNC_LLRINTF
if test "x$ac_cv_c99_lrint" = "xno" ; then
if test "x$ac_cv_c99_lrintf" = "xno" ; then
AC_MSG_WARN([[*** Missing C99 standard functions lrint() and lrintf().]])
AC_MSG_WARN([[*** This may cause benign compiler warnings on some systems (ie Solaris).]])
fi
fi
AX_C99_FLEXIBLE_ARRAY
AC_CHECK_FUNCS([memmove])
AC_CHECK_FUNCS([memset])
AC_CHECK_FUNCS([select])
AC_CHECK_FUNCS([strcasecmp])
AC_CHECK_FUNCS([strchr])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([strerror])
AC_CHECK_FUNCS([strstr])
AC_CHECK_FUNCS([strtol])
AC_CHECK_FUNCS([gettimeofday])
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
# Check for header files.
AC_CHECK_HEADERS([socket.h])
AC_CHECK_HEADERS([inttypes.h], [INSERT_INTTYPES_HEADER="#include <inttypes.h>"])
AC_CHECK_HEADERS([stdint.h], [INSERT_STDINT_HEADER="#include <stdint.h>"])
AC_CHECK_HEADERS([unistd.h])
AC_CHECK_HEADERS([stdlib.h])
AC_CHECK_HEADERS([string.h])
AC_CHECK_HEADERS([strings.h])
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_HEADERS([tgmath.h], [INSERT_TGMATH_HEADER="#include <tgmath.h>"])
AC_CHECK_HEADERS([math.h], [INSERT_MATH_HEADER="#include <math.h>"])
AC_CHECK_HEADERS([float.h])
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([sys/select.h])
AC_CHECK_HEADERS([sys/ioctl.h])
AC_CHECK_HEADERS([sys/fcntl.h])
AC_CHECK_HEADERS([sndfile.h])
AC_LANG([C])
if test "${build}" = "${host}"
then
case "${host}" in
x86_64-*)
AX_CHECK_FOLDERS([${prefix}/lib64], libdir='$(exec_prefix)/lib64')
;;
esac
fi
# Checks for libraries.
AC_CHECK_LIB([m], [cos])
# Some platforms still seem to lack the basic single precision trig and power related function.
AC_SEARCH_LIBS([sinf], [m], AC_DEFINE([HAVE_SINF], [1], [Define to 1 if you have the sinf() function.]))
AC_SEARCH_LIBS([cosf], [m], AC_DEFINE([HAVE_COSF], [1], [Define to 1 if you have the cosf() function.]))
AC_SEARCH_LIBS([tanf], [m], AC_DEFINE([HAVE_TANF], [1], [Define to 1 if you have the tanf() function.]))
AC_SEARCH_LIBS([asinf], [m], AC_DEFINE([HAVE_ASINF], [1], [Define to 1 if you have the asinf() function.]))
AC_SEARCH_LIBS([acosf], [m], AC_DEFINE([HAVE_ACOSF], [1], [Define to 1 if you have the acosf() function.]))
AC_SEARCH_LIBS([atanf], [m], AC_DEFINE([HAVE_ATANF], [1], [Define to 1 if you have the atanf() function.]))
AC_SEARCH_LIBS([atan2f], [m], AC_DEFINE([HAVE_ATAN2F], [1], [Define to 1 if you have the atan2f() function.]))
AC_SEARCH_LIBS([ceilf], [m], AC_DEFINE([HAVE_CEILF], [1], [Define to 1 if you have the ceilf() function.]))
AC_SEARCH_LIBS([floorf], [m], AC_DEFINE([HAVE_FLOORF], [1], [Define to 1 if you have the floorf() function.]))
AC_SEARCH_LIBS([powf], [m], AC_DEFINE([HAVE_POWF], [1], [Define to 1 if you have the powf() function.]))
AC_SEARCH_LIBS([expf], [m], AC_DEFINE([HAVE_EXPF], [1], [Define to 1 if you have the expf() function.]))
AC_SEARCH_LIBS([logf], [m], AC_DEFINE([HAVE_LOGF], [1], [Define to 1 if you have the logf() function.]))
AC_SEARCH_LIBS([log10f], [m], AC_DEFINE([HAVE_LOG10F], [1], [Define to 1 if you have the log10f() function.]))
if test -n "$enable_tests" ; then
AC_CHECK_LIB([sndfile], [sf_open], TESTLIBS="$TESTLIBS -lsndfile", AC_MSG_ERROR("Can't make tests without libsndfile (does your system require a libsndfile-devel package?)"))
fi
AX_CHECK_EXPORT_CAPABILITY([$host],
[AC_DEFINE([BROADVOICE_USE_EXPORT_CAPABILITY], [1], [Use the library symbol export capability of the compiler])
BROADVOICE_USE_EXPORT_CAPABILITY="#define BROADVOICE_USE_EXPORT_CAPABILITY 1"],
[BROADVOICE_USE_EXPORT_CAPABILITY="#undef BROADVOICE_USE_EXPORT_CAPABILITY"])
case "${ax_cv_c_compiler_vendor}" in
gnu)
COMP_VENDOR_CFLAGS="-std=gnu99 -ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
if test "$enable_sse5" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse5 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse4a" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse4a $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse4_2" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse42 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse4_1" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse41 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse3" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse3 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse2" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse2 $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse" = "yes" ; then
COMP_VENDOR_CFLAGS="-msse $COMP_VENDOR_CFLAGS"
fi
if test "$enable_mmx" = "yes" ; then
COMP_VENDOR_CFLAGS="-mmmx $COMP_VENDOR_CFLAGS"
fi
case $host_os in
mingw* | cygwin*)
COMP_VENDOR_LDFLAGS="-no-undefined"
;;
*)
COMP_VENDOR_LDFLAGS=
;;
esac
;;
sun)
COMP_VENDOR_CFLAGS="-xc99=all -mt -xCC -errwarn=%all -xvpara"
if test "$enable_sse3" = "yes" ; then
COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse2" = "yes" ; then
COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
fi
if test "$enable_sse" = "yes" ; then
COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
fi
if test "$enable_mmx" = "yes" ; then
COMP_VENDOR_CFLAGS="-native -fast $COMP_VENDOR_CFLAGS"
fi
COMP_VENDOR_LDFLAGS=
REMOVE_FROM_VAR(CFLAGS, -Xc)
;;
*)
COMP_VENDOR_CFLAGS="-std=c99 -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes"
COMP_VENDOR_LDFLAGS=
;;
esac
COMP_VENDOR_CFLAGS="-DNDEBUG $COMP_VENDOR_CFLAGS"
AM_CONDITIONAL([COND_DOC], [test "$enable_doc" = yes])
AM_CONDITIONAL([COND_TESTS], [test "$enable_tests" = yes])
AM_CONDITIONAL([COND_TESTDATA], [test "$enable_test_data" = yes])
AM_CONDITIONAL([COND_MMX], [test "$enable_mmx" = yes])
AM_CONDITIONAL([COND_SSE], [test "$enable_sse" = yes])
AM_CONDITIONAL([COND_SSE2], [test "$enable_sse2" = yes])
AM_CONDITIONAL([COND_SSE3], [test "$enable_sse3" = yes])
AM_CONDITIONAL([COND_SSE4_1], [test "$enable_sse4_1" = yes])
AM_CONDITIONAL([COND_SSE4_2], [test "$enable_sse4_2" = yes])
AM_CONDITIONAL([COND_SSE4A], [test "$enable_sse4a" = yes])
AM_CONDITIONAL([COND_SSE5], [test "$enable_sse5" = yes])
if test "$enable_fixed_point" = "yes" ; then
AC_DEFINE([BROADVOICE_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
BROADVOICE_USE_FIXED_POINT="#define BROADVOICE_USE_FIXED_POINT 1"
BROADVOICE_VECTORS_FOR_TESTS="fixed"
else
AX_FIXED_POINT_MACHINE([$host],
[AC_DEFINE([BROADVOICE_USE_FIXED_POINT], [1], [Enable fixed point processing, where possible, instead of floating point])
BROADVOICE_USE_FIXED_POINT="#define BROADVOICE_USE_FIXED_POINT 1"],
[BROADVOICE_USE_FIXED_POINT="#undef BROADVOICE_USE_FIXED_POINT"])
BROADVOICE_VECTORS_FOR_TESTS="floating"
fi
AX_MISALIGNED_ACCESS_FAILS([$host],
[AC_DEFINE([BROADVOICE_MISALIGNED_ACCESS_FAILS], [1], [Do not expect a misaligned memory access to work correctly])
BROADVOICE_MISALIGNED_ACCESS_FAILS="#define BROADVOICE_MISALIGNED_ACCESS_FAILS 1"],
[BROADVOICE_MISALIGNED_ACCESS_FAILS="#undef BROADVOICE_MISALIGNED_ACCESS_FAILS"])
if test "$enable_sse5" = "yes" ; then
AC_DEFINE([BROADVOICE_USE_SSE5], [1], [Use the SSE5 instruction set (i386 and x86_64 only).])
enable_sse4a="yes"
fi
if test "$enable_sse4a" = "yes" ; then
AC_DEFINE([BROADVOICE_USE_SSE4A], [1], [Use the SSE4A instruction set (i386 and x86_64 only).])
enable_sse4_2="yes"
fi
if test "$enable_sse4_2" = "yes" ; then
AC_DEFINE([BROADVOICE_USE_SSE4_2], [1], [Use the SSE4.2 instruction set (i386 and x86_64 only).])
enable_sse4_1="yes"
fi
if test "$enable_sse4_1" = "yes" ; then
AC_DEFINE([BROADVOICE_USE_SSE4_1], [1], [Use the SSE4.1 instruction set (i386 and x86_64 only).])
enable_sse3="yes"
fi
if test "$enable_sse3" = "yes" ; then
AC_DEFINE([BROADVOICE_USE_SSE3], [1], [Use the SSE3 instruction set (i386 and x86_64 only).])
enable_sse2="yes"
fi
if test "$enable_sse2" = "yes" ; then
AC_DEFINE([BROADVOICE_USE_SSE2], [1], [Use the SSE2 instruction set (i386 and x86_64 only).])
enable_sse="yes"
fi
if test "$enable_sse" = "yes" ; then
AC_DEFINE([BROADVOICE_USE_SSE], [1], [Use the SSE instruction set (i386 and x86_64 only).])
enable_mmx="yes"
fi
if test "$enable_mmx" = "yes" ; then
AC_DEFINE([BROADVOICE_USE_MMX], [1], [Use the MMX instruction set (i386 and x86_64 only).])
fi
AC_SUBST(CC_FOR_BUILD)
AC_SUBST(COMP_VENDOR_CFLAGS)
AC_SUBST(COMP_VENDOR_LDFLAGS)
AC_SUBST(TESTLIBS)
AC_SUBST(BROADVOICE_USE_FIXED_POINT)
AC_SUBST(BROADVOICE_MISALIGNED_ACCESS_FAILS)
AC_SUBST(BROADVOICE_USE_EXPORT_CAPABILITY)
AC_SUBST(BROADVOICE_VECTORS_FOR_TESTS)
AC_SUBST(INSERT_INTTYPES_HEADER)
AC_SUBST(INSERT_STDINT_HEADER)
AC_SUBST(INSERT_TGMATH_HEADER)
AC_SUBST(INSERT_MATH_HEADER)
AC_CONFIG_FILES([Makefile
doc/Makefile
src/Makefile
src/broadvoice.h
broadvoice.pc
broadvoice.spec])
AC_CONFIG_FILES([tests/regression_tests.sh], [chmod +x tests/regression_tests.sh])
AC_OUTPUT
# @end 1