| 1 |
dnl Usage: |
| 2 |
dnl AM_PATH_MAD([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) |
| 3 |
dnl Test for MAD audio library, and defines |
| 4 |
dnl prerequisites: |
| 5 |
|
| 6 |
AC_DEFUN([AM_PATH_MAD], |
| 7 |
[ |
| 8 |
AC_REQUIRE([AC_CANONICAL_HOST]) |
| 9 |
AC_REQUIRE([AC_CANONICAL_TARGET]) |
| 10 |
|
| 11 |
MAD_CFLAGS= |
| 12 |
MAD_LIBS= |
| 13 |
ac_enable_libmad=yes |
| 14 |
AC_ARG_WITH(mad_prefix, AC_HELP_STRING(--with-mad-prefix=PFX,[where MAD library is installed. [[internal]]]), |
| 15 |
[], with_mad_prefix=internal) |
| 16 |
if test "$with_mad_prefix" != internal; then |
| 17 |
ac_save_LDFLAGS=$LDFLAGS |
| 18 |
ac_save_LIBS=$LIBS |
| 19 |
if test -n "$with_mad_prefix" -a "$with_mad_prefix" != "/usr"; then |
| 20 |
MAD_CFLAGS="-I$with_mad_prefix/include" |
| 21 |
LDFLAGS="-L$with_mad_prefix/lib" |
| 22 |
fi |
| 23 |
AC_CHECK_LIB(mad, mad_stream_init, |
| 24 |
MAD_LIBS="$LDFLAGS -lmad", ac_enable_libmad=no) |
| 25 |
LDFLAGS=$ac_save_LDFLAGS |
| 26 |
LIBS=$ac_save_LIBS |
| 27 |
AC_SUBST(MAD_CFLAGS) |
| 28 |
AC_SUBST(MAD_LIBS) |
| 29 |
else |
| 30 |
AC_MSG_RESULT(checking for mad library... using internal version) |
| 31 |
fi |
| 32 |
|
| 33 |
AC_ARG_ENABLE(mad_speed, [ --disable-mad-speed build internal MAD for speed. [[enabled]]], |
| 34 |
[], enable_mad_speed=yes) |
| 35 |
if test "$enable_mad_speed" = yes; then |
| 36 |
AC_DEFINE(OPT_SPEED, 1, [MAD Define to optimize for speed over accuracy.]) |
| 37 |
fi |
| 38 |
AC_ARG_ENABLE(mad, [ --enable-mad-accuracy build internal MAD for accuracy. [[disabled]]], |
| 39 |
[], enable_mad=no) |
| 40 |
if test "$enable_mad_speed" = yes -a "$enable_mad_speed" = no; then |
| 41 |
AC_DEFINE(OPT_ACCURACY, 1, [MAD Define to optimize for accuracy over speed.]) |
| 42 |
fi |
| 43 |
|
| 44 |
case "$target" in |
| 45 |
i?86*) AC_DEFINE(FPM_INTEL, 1, [MAD Define intel fixed-point math routines.]) ;; |
| 46 |
arm*) AC_DEFINE(FPM_ARM, 1, [MAD Define arm fixed-point math routines.]) ;; |
| 47 |
mips*) AC_DEFINE(FPM_MIPS, 1, [MAD Define mips fixed-point math routines.]) ;; |
| 48 |
sparc*) AC_DEFINE(FPM_SPARC, 1, [MAD Define sparc fixed-point math routines.]) ;; |
| 49 |
powerpc*) AC_DEFINE(FPM_PPC, 1, [MAD Define powerpc fixed-point math routines.]) ;; |
| 50 |
*) AC_DEFINE(FPM_DEFAULT, 1, [MAD Define default fixed-point math routines.]) ;; |
| 51 |
esac |
| 52 |
|
| 53 |
AC_ARG_ENABLE(madsso, [ --disable-mad-sso use subband synthesis optimization. [[enabled]]], |
| 54 |
[], enable_madsso=yes) |
| 55 |
if test "$enable_madsso" = yes; then |
| 56 |
AC_DEFINE(OPT_SSO, 1, [MAD Define to enable a fast subband synthesis approximation optimization.]) |
| 57 |
fi |
| 58 |
AC_ARG_ENABLE(madaso, [ --disable-mad-aso disable architecture-specific optimizations. [[enabled]]], |
| 59 |
[], enable_madaso=yes) |
| 60 |
if test "$enable_madaso" = yes; then |
| 61 |
case "$target" in |
| 62 |
i?86*) |
| 63 |
AC_DEFINE(ASO_ZEROCHECK, 1, [MAD Define for fast subband synthesis approximation.]) |
| 64 |
;; |
| 65 |
esac |
| 66 |
fi |
| 67 |
|
| 68 |
if test "$ac_enable_libmad" = yes; then |
| 69 |
ifelse([$1], , :, [$1]) |
| 70 |
else |
| 71 |
ifelse([$2], , :, [$2]) |
| 72 |
fi |
| 73 |
]) |
| 74 |
|