comparison src/libmad-0.15.1b/configure.ac @ 0:c7265573341e

Import initial set of sources
author Chris Cannam
date Mon, 18 Mar 2013 14:12:14 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:c7265573341e
1 dnl -*- m4 -*-
2 dnl
3 dnl libmad - MPEG audio decoder library
4 dnl Copyright (C) 2000-2004 Underbit Technologies, Inc.
5 dnl
6 dnl This program is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 2 of the License, or
9 dnl (at your option) any later version.
10 dnl
11 dnl This program is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 dnl GNU General Public License for more details.
15 dnl
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with this program; if not, write to the Free Software
18 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 dnl
20 AC_REVISION([$Id: configure.ac,v 1.9 2004/01/23 09:41:32 rob Exp $])dnl
21
22 dnl Process this file with autoconf to produce a configure script.
23
24 AC_INIT([MPEG Audio Decoder], [0.15.1b], [support@underbit.com], [libmad])
25 AC_PREREQ(2.53)
26
27 AC_CONFIG_SRCDIR([decoder.h])
28
29 AM_INIT_AUTOMAKE
30
31 AM_CONFIG_HEADER([config.h])
32
33 dnl System type.
34
35 AC_CANONICAL_HOST
36
37 dnl Checks for programs.
38
39 AC_PROG_CC
40 AM_PROG_AS
41
42 if test "$GCC" = yes
43 then
44 case "$host" in
45 *-*-mingw*)
46 case "$build" in
47 *-*-cygwin*)
48 CPPFLAGS="$CPPFLAGS -mno-cygwin"
49 LDFLAGS="$LDFLAGS -mno-cygwin"
50 ;;
51 esac
52 esac
53
54 dnl case "$host" in
55 dnl *-*-cygwin* | *-*-mingw*)
56 dnl LDFLAGS="$LDFLAGS -no-undefined -mdll"
57 dnl ;;
58 dnl esac
59 fi
60
61 dnl Support for libtool.
62
63 dnl AC_DISABLE_SHARED
64 dnl AC_LIBTOOL_WIN32_DLL
65 AC_PROG_LIBTOOL
66
67 AC_SUBST(LIBTOOL_DEPS)
68
69 dnl Compiler options.
70
71 arch=""
72 debug=""
73 optimize=""
74 profile=""
75
76 set -- $CFLAGS
77 CFLAGS=""
78
79 if test "$GCC" = yes
80 then
81 CFLAGS="-Wall"
82 fi
83
84 while test $# -gt 0
85 do
86 case "$1" in
87 -Wall)
88 if test "$GCC" = yes
89 then
90 :
91 else
92 CFLAGS="$CFLAGS $1"
93 fi
94 shift
95 ;;
96 -g)
97 debug="-g"
98 shift
99 ;;
100 -mno-cygwin)
101 shift
102 ;;
103 -m*)
104 arch="$arch $1"
105 shift
106 ;;
107 -O2)
108 optimize="-O"
109 shift
110 ;;
111 -fomit-frame-pointer)
112 shift
113 ;;
114 -O*|-f*)
115 optimize="$optimize $1"
116 shift
117 ;;
118 *)
119 CFLAGS="$CFLAGS $1"
120 shift
121 ;;
122 esac
123 done
124
125 if test "$GCC" = yes
126 then
127 if test -z "$arch"
128 then
129 case "$host" in
130 i386-*) ;;
131 i?86-*) arch="-march=i486" ;;
132 arm*-empeg-*) arch="-march=armv4 -mtune=strongarm1100" ;;
133 armv4*-*) arch="-march=armv4 -mtune=strongarm" ;;
134 powerpc-*) ;;
135 mips*-agenda-*) arch="-mcpu=vr4100" ;;
136 mips*-luxsonor-*) arch="-mips1 -mcpu=r3000 -Wa,-m4010" ;;
137 esac
138 fi
139
140 case "$optimize" in
141 -O|"-O "*)
142 optimize="-O"
143 optimize="$optimize -fforce-mem"
144 optimize="$optimize -fforce-addr"
145 : #x optimize="$optimize -finline-functions"
146 : #- optimize="$optimize -fstrength-reduce"
147 optimize="$optimize -fthread-jumps"
148 optimize="$optimize -fcse-follow-jumps"
149 optimize="$optimize -fcse-skip-blocks"
150 : #x optimize="$optimize -frerun-cse-after-loop"
151 : #x optimize="$optimize -frerun-loop-opt"
152 : #x optimize="$optimize -fgcse"
153 optimize="$optimize -fexpensive-optimizations"
154 optimize="$optimize -fregmove"
155 : #* optimize="$optimize -fdelayed-branch"
156 : #x optimize="$optimize -fschedule-insns"
157 optimize="$optimize -fschedule-insns2"
158 : #? optimize="$optimize -ffunction-sections"
159 : #? optimize="$optimize -fcaller-saves"
160 : #> optimize="$optimize -funroll-loops"
161 : #> optimize="$optimize -funroll-all-loops"
162 : #x optimize="$optimize -fmove-all-movables"
163 : #x optimize="$optimize -freduce-all-givs"
164 : #? optimize="$optimize -fstrict-aliasing"
165 : #* optimize="$optimize -fstructure-noalias"
166
167 case "$host" in
168 arm*-*)
169 optimize="$optimize -fstrength-reduce"
170 ;;
171 mips*-*)
172 optimize="$optimize -fstrength-reduce"
173 optimize="$optimize -finline-functions"
174 ;;
175 i?86-*)
176 optimize="$optimize -fstrength-reduce"
177 ;;
178 powerpc-apple-*)
179 # this triggers an internal compiler error with gcc2
180 : #optimize="$optimize -fstrength-reduce"
181
182 # this is really only beneficial with gcc3
183 : #optimize="$optimize -finline-functions"
184 ;;
185 *)
186 # this sometimes provokes bugs in gcc 2.95.2
187 : #optimize="$optimize -fstrength-reduce"
188 ;;
189 esac
190 ;;
191 esac
192 fi
193
194 case "$host" in
195 mips*-agenda-*)
196 AC_DEFINE(HAVE_MADD16_ASM, 1,
197 [Define if your MIPS CPU supports a 2-operand MADD16 instruction.])
198 ;;
199 mips*-luxsonor-*)
200 AC_DEFINE(HAVE_MADD_ASM, 1,
201 [Define if your MIPS CPU supports a 2-operand MADD instruction.])
202 ;;
203 esac
204
205 dnl Checks for header files.
206
207 AC_HEADER_STDC
208 AC_HEADER_SYS_WAIT
209 AC_CHECK_HEADERS(assert.h limits.h unistd.h sys/types.h fcntl.h errno.h)
210
211 dnl Checks for typedefs, structures, and compiler characteristics.
212
213 AC_C_CONST
214 AC_C_INLINE
215 AC_C_BIGENDIAN
216 AC_TYPE_PID_T
217
218 AC_CHECK_SIZEOF(int, 2)
219 AC_CHECK_SIZEOF(long, 4)
220 AC_CHECK_SIZEOF(long long, 8)
221
222 dnl Checks for library functions.
223
224 AC_CHECK_FUNCS(waitpid fcntl pipe fork)
225
226 dnl Other options.
227
228 AC_SUBST(FPM)
229 AC_SUBST(ASO)
230 AC_SUBST(ASO_OBJS)
231
232 dnl handle --enable and --disable options
233
234 AC_CACHE_SAVE
235
236 AC_MSG_CHECKING(whether to optimize for speed or for accuracy)
237
238 AC_ARG_ENABLE(speed, AC_HELP_STRING([--enable-speed],
239 [optimize for speed over accuracy]),
240 [
241 case "$enableval" in
242 yes)
243 optimize_for="speed"
244 AC_DEFINE(OPT_SPEED, 1,
245 [Define to optimize for speed over accuracy.])
246 ;;
247 esac
248 ])
249
250 AC_ARG_ENABLE(accuracy, AC_HELP_STRING([--enable-accuracy],
251 [optimize for accuracy over speed]),
252 [
253 case "$enableval" in
254 yes)
255 if test "$optimize_for" = "speed"
256 then
257 optimize_for="both"
258 else
259 optimize_for="accuracy"
260 fi
261 AC_DEFINE(OPT_ACCURACY, 1,
262 [Define to optimize for accuracy over speed.])
263 ;;
264 esac
265 ])
266
267 AC_MSG_RESULT(${optimize_for-default})
268
269 if test "$optimize_for" = "both"
270 then
271 AC_MSG_ERROR(cannot optimize for both speed and accuracy)
272 fi
273
274 AC_MSG_CHECKING(for architecture-specific fixed-point math routines)
275 AC_ARG_ENABLE(fpm, AC_HELP_STRING([--enable-fpm=ARCH],
276 [use ARCH-specific fixed-point math routines
277 (one of: intel, arm, mips, sparc, ppc, 64bit, default)]),
278 [
279 case "$enableval" in
280 yes) ;;
281 no|default|approx) FPM="DEFAULT" ;;
282 intel|i?86) FPM="INTEL" ;;
283 arm) FPM="ARM" ;;
284 mips) FPM="MIPS" ;;
285 sparc) FPM="SPARC" ;;
286 ppc|powerpc) FPM="PPC" ;;
287 64bit) FPM="64BIT" ;;
288 float) FPM="FLOAT" ;;
289 *)
290 AC_MSG_RESULT(failed)
291 AC_MSG_ERROR([bad --enable-fpm option])
292 ;;
293 esac
294 ])
295
296 if test -z "$FPM" && test "$GCC" = yes
297 then
298 case "$host" in
299 i?86-*) FPM="INTEL" ;;
300 arm*-*) FPM="ARM" ;;
301 mips*-*) FPM="MIPS" ;;
302 sparc*-*) FPM="SPARC" ;;
303 powerpc*-*) FPM="PPC" ;;
304 # FIXME: need to test for 64-bit long long...
305 esac
306 fi
307
308 AC_MSG_RESULT(${FPM=DEFAULT})
309
310 if test "$FPM" = "DEFAULT"
311 then
312 AC_MSG_WARN([default fixed-point math will yield limited accuracy])
313 fi
314
315 FPM="-DFPM_$FPM"
316
317 AC_ARG_ENABLE(sso, AC_HELP_STRING([--enable-sso],
318 [use subband synthesis optimization]),
319 [
320 case "$enableval" in
321 yes)
322 AC_DEFINE(OPT_SSO, 1,
323 [Define to enable a fast subband synthesis approximation optimization.])
324 ;;
325 esac
326 ])
327
328 AC_ARG_ENABLE(aso, AC_HELP_STRING([--disable-aso],
329 [disable architecture-specific optimizations]),
330 [], [enable_aso=yes])
331
332 if test "$enable_aso" = yes
333 then
334 case "$host" in
335 i?86-*)
336 : #ASO="$ASO -DASO_INTERLEAVE1"
337 ASO="$ASO -DASO_ZEROCHECK"
338 : #not yet #ASO="$ASO -DASO_SYNTH"
339 : #not yet #ASO_OBJS="synth_mmx.lo"
340 ;;
341 arm*-*)
342 ASO="$ASO -DASO_INTERLEAVE1"
343 ASO="$ASO -DASO_IMDCT"
344 ASO_OBJS="imdct_l_arm.lo"
345 ;;
346 mips*-*)
347 ASO="$ASO -DASO_INTERLEAVE2"
348 ASO="$ASO -DASO_ZEROCHECK"
349 ;;
350 esac
351 fi
352
353 AC_MSG_CHECKING(for ISO/IEC interpretation)
354 AC_ARG_ENABLE(strict-iso, AC_HELP_STRING([--enable-strict-iso],
355 [use strict ISO/IEC interpretations]),
356 [
357 case "$enableval" in
358 yes)
359 AC_DEFINE(OPT_STRICT, 1,
360 [Define to influence a strict interpretation of the ISO/IEC standards,
361 even if this is in opposition with best accepted practices.])
362 interpretation="strict"
363 ;;
364 esac
365 ])
366 AC_MSG_RESULT(${interpretation-best accepted practices})
367
368 AC_MSG_CHECKING(whether to enable profiling)
369 AC_ARG_ENABLE(profiling, AC_HELP_STRING([--enable-profiling],
370 [generate profiling code]),
371 [
372 case "$enableval" in
373 yes) profile="-pg" ;;
374 esac
375 ])
376 AC_MSG_RESULT(${enable_profiling-no})
377
378 AC_MSG_CHECKING(whether to enable debugging)
379 AC_ARG_ENABLE(debugging, AC_HELP_STRING([--enable-debugging],
380 [enable diagnostic debugging support])
381 AC_HELP_STRING([--disable-debugging],
382 [do not enable debugging and use more optimization]),
383 [
384 case "$enableval" in
385 yes)
386 AC_DEFINE(DEBUG, 1,
387 [Define to enable diagnostic debugging support.])
388 optimize=""
389 ;;
390 no)
391 if test -n "$profile"
392 then
393 AC_MSG_ERROR(--enable-profiling and --disable-debugging are incompatible)
394 fi
395
396 AC_DEFINE(NDEBUG, 1,
397 [Define to disable debugging assertions.])
398 debug=""
399 if test "$GCC" = yes
400 then
401 optimize="$optimize -fomit-frame-pointer"
402 fi
403 ;;
404 esac
405 ])
406 AC_MSG_RESULT(${enable_debugging-default})
407
408 AC_MSG_CHECKING(whether to enable experimental code)
409 AC_ARG_ENABLE(experimental, AC_HELP_STRING([--enable-experimental],
410 [enable experimental code]),
411 [
412 case "$enableval" in
413 yes)
414 AC_DEFINE(EXPERIMENTAL, 1,
415 [Define to enable experimental code.])
416 ;;
417 esac
418 ])
419 AC_MSG_RESULT(${enable_experimental-no})
420
421 dnl Create output files.
422
423 test -n "$arch" && CFLAGS="$CFLAGS $arch"
424 test -n "$debug" && CFLAGS="$CFLAGS $debug"
425 test -n "$optimize" && CFLAGS="$CFLAGS $optimize"
426 test -n "$profile" && CFLAGS="$CFLAGS $profile" LDFLAGS="$LDFLAGS $profile"
427
428 dnl LTLIBOBJS=`echo "$LIBOBJS" | sed -e 's/\.o/.lo/g'`
429 dnl AC_SUBST(LTLIBOBJS)
430
431 AC_CONFIG_FILES([Makefile msvc++/Makefile \
432 libmad.list])
433 AC_OUTPUT