cannam@85: dnl -*- m4 -*- cannam@85: dnl cannam@85: dnl libmad - MPEG audio decoder library cannam@85: dnl Copyright (C) 2000-2004 Underbit Technologies, Inc. cannam@85: dnl cannam@85: dnl This program is free software; you can redistribute it and/or modify cannam@85: dnl it under the terms of the GNU General Public License as published by cannam@85: dnl the Free Software Foundation; either version 2 of the License, or cannam@85: dnl (at your option) any later version. cannam@85: dnl cannam@85: dnl This program is distributed in the hope that it will be useful, cannam@85: dnl but WITHOUT ANY WARRANTY; without even the implied warranty of cannam@85: dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the cannam@85: dnl GNU General Public License for more details. cannam@85: dnl cannam@85: dnl You should have received a copy of the GNU General Public License cannam@85: dnl along with this program; if not, write to the Free Software cannam@85: dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA cannam@85: dnl cannam@85: AC_REVISION([$Id: configure.ac,v 1.9 2004/01/23 09:41:32 rob Exp $])dnl cannam@85: cannam@85: dnl Process this file with autoconf to produce a configure script. cannam@85: cannam@85: AC_INIT([MPEG Audio Decoder], [0.15.1b], [support@underbit.com], [libmad]) cannam@85: AC_PREREQ(2.53) cannam@85: cannam@85: AC_CONFIG_SRCDIR([decoder.h]) cannam@85: cannam@85: AM_INIT_AUTOMAKE cannam@85: cannam@85: AM_CONFIG_HEADER([config.h]) cannam@85: cannam@85: dnl System type. cannam@85: cannam@85: AC_CANONICAL_HOST cannam@85: cannam@85: dnl Checks for programs. cannam@85: cannam@85: AC_PROG_CC cannam@85: AM_PROG_AS cannam@85: cannam@85: if test "$GCC" = yes cannam@85: then cannam@85: case "$host" in cannam@85: *-*-mingw*) cannam@85: case "$build" in cannam@85: *-*-cygwin*) cannam@85: CPPFLAGS="$CPPFLAGS -mno-cygwin" cannam@85: LDFLAGS="$LDFLAGS -mno-cygwin" cannam@85: ;; cannam@85: esac cannam@85: esac cannam@85: cannam@85: dnl case "$host" in cannam@85: dnl *-*-cygwin* | *-*-mingw*) cannam@85: dnl LDFLAGS="$LDFLAGS -no-undefined -mdll" cannam@85: dnl ;; cannam@85: dnl esac cannam@85: fi cannam@85: cannam@85: dnl Support for libtool. cannam@85: cannam@85: dnl AC_DISABLE_SHARED cannam@85: dnl AC_LIBTOOL_WIN32_DLL cannam@85: AC_PROG_LIBTOOL cannam@85: cannam@85: AC_SUBST(LIBTOOL_DEPS) cannam@85: cannam@85: dnl Compiler options. cannam@85: cannam@85: arch="" cannam@85: debug="" cannam@85: optimize="" cannam@85: profile="" cannam@85: cannam@85: set -- $CFLAGS cannam@85: CFLAGS="" cannam@85: cannam@85: if test "$GCC" = yes cannam@85: then cannam@85: CFLAGS="-Wall" cannam@85: fi cannam@85: cannam@85: while test $# -gt 0 cannam@85: do cannam@85: case "$1" in cannam@85: -Wall) cannam@85: if test "$GCC" = yes cannam@85: then cannam@85: : cannam@85: else cannam@85: CFLAGS="$CFLAGS $1" cannam@85: fi cannam@85: shift cannam@85: ;; cannam@85: -g) cannam@85: debug="-g" cannam@85: shift cannam@85: ;; cannam@85: -mno-cygwin) cannam@85: shift cannam@85: ;; cannam@85: -m*) cannam@85: arch="$arch $1" cannam@85: shift cannam@85: ;; cannam@85: -O2) cannam@85: optimize="-O" cannam@85: shift cannam@85: ;; cannam@85: -fomit-frame-pointer) cannam@85: shift cannam@85: ;; cannam@85: -O*|-f*) cannam@85: optimize="$optimize $1" cannam@85: shift cannam@85: ;; cannam@85: *) cannam@85: CFLAGS="$CFLAGS $1" cannam@85: shift cannam@85: ;; cannam@85: esac cannam@85: done cannam@85: cannam@85: if test "$GCC" = yes cannam@85: then cannam@85: if test -z "$arch" cannam@85: then cannam@85: case "$host" in cannam@85: i386-*) ;; cannam@85: i?86-*) arch="-march=i486" ;; cannam@85: arm*-empeg-*) arch="-march=armv4 -mtune=strongarm1100" ;; cannam@85: armv4*-*) arch="-march=armv4 -mtune=strongarm" ;; cannam@85: powerpc-*) ;; cannam@85: mips*-agenda-*) arch="-mcpu=vr4100" ;; cannam@85: mips*-luxsonor-*) arch="-mips1 -mcpu=r3000 -Wa,-m4010" ;; cannam@85: esac cannam@85: fi cannam@85: cannam@85: case "$optimize" in cannam@85: -O|"-O "*) cannam@85: optimize="-O" cannam@85: optimize="$optimize -fforce-mem" cannam@85: optimize="$optimize -fforce-addr" cannam@85: : #x optimize="$optimize -finline-functions" cannam@85: : #- optimize="$optimize -fstrength-reduce" cannam@85: optimize="$optimize -fthread-jumps" cannam@85: optimize="$optimize -fcse-follow-jumps" cannam@85: optimize="$optimize -fcse-skip-blocks" cannam@85: : #x optimize="$optimize -frerun-cse-after-loop" cannam@85: : #x optimize="$optimize -frerun-loop-opt" cannam@85: : #x optimize="$optimize -fgcse" cannam@85: optimize="$optimize -fexpensive-optimizations" cannam@85: optimize="$optimize -fregmove" cannam@85: : #* optimize="$optimize -fdelayed-branch" cannam@85: : #x optimize="$optimize -fschedule-insns" cannam@85: optimize="$optimize -fschedule-insns2" cannam@85: : #? optimize="$optimize -ffunction-sections" cannam@85: : #? optimize="$optimize -fcaller-saves" cannam@85: : #> optimize="$optimize -funroll-loops" cannam@85: : #> optimize="$optimize -funroll-all-loops" cannam@85: : #x optimize="$optimize -fmove-all-movables" cannam@85: : #x optimize="$optimize -freduce-all-givs" cannam@85: : #? optimize="$optimize -fstrict-aliasing" cannam@85: : #* optimize="$optimize -fstructure-noalias" cannam@85: cannam@85: case "$host" in cannam@85: arm*-*) cannam@85: optimize="$optimize -fstrength-reduce" cannam@85: ;; cannam@85: mips*-*) cannam@85: optimize="$optimize -fstrength-reduce" cannam@85: optimize="$optimize -finline-functions" cannam@85: ;; cannam@85: i?86-*) cannam@85: optimize="$optimize -fstrength-reduce" cannam@85: ;; cannam@85: powerpc-apple-*) cannam@85: # this triggers an internal compiler error with gcc2 cannam@85: : #optimize="$optimize -fstrength-reduce" cannam@85: cannam@85: # this is really only beneficial with gcc3 cannam@85: : #optimize="$optimize -finline-functions" cannam@85: ;; cannam@85: *) cannam@85: # this sometimes provokes bugs in gcc 2.95.2 cannam@85: : #optimize="$optimize -fstrength-reduce" cannam@85: ;; cannam@85: esac cannam@85: ;; cannam@85: esac cannam@85: fi cannam@85: cannam@85: case "$host" in cannam@85: mips*-agenda-*) cannam@85: AC_DEFINE(HAVE_MADD16_ASM, 1, cannam@85: [Define if your MIPS CPU supports a 2-operand MADD16 instruction.]) cannam@85: ;; cannam@85: mips*-luxsonor-*) cannam@85: AC_DEFINE(HAVE_MADD_ASM, 1, cannam@85: [Define if your MIPS CPU supports a 2-operand MADD instruction.]) cannam@85: ;; cannam@85: esac cannam@85: cannam@85: dnl Checks for header files. cannam@85: cannam@85: AC_HEADER_STDC cannam@85: AC_HEADER_SYS_WAIT cannam@85: AC_CHECK_HEADERS(assert.h limits.h unistd.h sys/types.h fcntl.h errno.h) cannam@85: cannam@85: dnl Checks for typedefs, structures, and compiler characteristics. cannam@85: cannam@85: AC_C_CONST cannam@85: AC_C_INLINE cannam@85: AC_C_BIGENDIAN cannam@85: AC_TYPE_PID_T cannam@85: cannam@85: AC_CHECK_SIZEOF(int, 2) cannam@85: AC_CHECK_SIZEOF(long, 4) cannam@85: AC_CHECK_SIZEOF(long long, 8) cannam@85: cannam@85: dnl Checks for library functions. cannam@85: cannam@85: AC_CHECK_FUNCS(waitpid fcntl pipe fork) cannam@85: cannam@85: dnl Other options. cannam@85: cannam@85: AC_SUBST(FPM) cannam@85: AC_SUBST(ASO) cannam@85: AC_SUBST(ASO_OBJS) cannam@85: cannam@85: dnl handle --enable and --disable options cannam@85: cannam@85: AC_CACHE_SAVE cannam@85: cannam@85: AC_MSG_CHECKING(whether to optimize for speed or for accuracy) cannam@85: cannam@85: AC_ARG_ENABLE(speed, AC_HELP_STRING([--enable-speed], cannam@85: [optimize for speed over accuracy]), cannam@85: [ cannam@85: case "$enableval" in cannam@85: yes) cannam@85: optimize_for="speed" cannam@85: AC_DEFINE(OPT_SPEED, 1, cannam@85: [Define to optimize for speed over accuracy.]) cannam@85: ;; cannam@85: esac cannam@85: ]) cannam@85: cannam@85: AC_ARG_ENABLE(accuracy, AC_HELP_STRING([--enable-accuracy], cannam@85: [optimize for accuracy over speed]), cannam@85: [ cannam@85: case "$enableval" in cannam@85: yes) cannam@85: if test "$optimize_for" = "speed" cannam@85: then cannam@85: optimize_for="both" cannam@85: else cannam@85: optimize_for="accuracy" cannam@85: fi cannam@85: AC_DEFINE(OPT_ACCURACY, 1, cannam@85: [Define to optimize for accuracy over speed.]) cannam@85: ;; cannam@85: esac cannam@85: ]) cannam@85: cannam@85: AC_MSG_RESULT(${optimize_for-default}) cannam@85: cannam@85: if test "$optimize_for" = "both" cannam@85: then cannam@85: AC_MSG_ERROR(cannot optimize for both speed and accuracy) cannam@85: fi cannam@85: cannam@85: AC_MSG_CHECKING(for architecture-specific fixed-point math routines) cannam@85: AC_ARG_ENABLE(fpm, AC_HELP_STRING([--enable-fpm=ARCH], cannam@85: [use ARCH-specific fixed-point math routines cannam@85: (one of: intel, arm, mips, sparc, ppc, 64bit, default)]), cannam@85: [ cannam@85: case "$enableval" in cannam@85: yes) ;; cannam@85: no|default|approx) FPM="DEFAULT" ;; cannam@85: intel|i?86) FPM="INTEL" ;; cannam@85: arm) FPM="ARM" ;; cannam@85: mips) FPM="MIPS" ;; cannam@85: sparc) FPM="SPARC" ;; cannam@85: ppc|powerpc) FPM="PPC" ;; cannam@85: 64bit) FPM="64BIT" ;; cannam@85: float) FPM="FLOAT" ;; cannam@85: *) cannam@85: AC_MSG_RESULT(failed) cannam@85: AC_MSG_ERROR([bad --enable-fpm option]) cannam@85: ;; cannam@85: esac cannam@85: ]) cannam@85: cannam@85: if test -z "$FPM" && test "$GCC" = yes cannam@85: then cannam@85: case "$host" in cannam@85: i?86-*) FPM="INTEL" ;; cannam@85: arm*-*) FPM="ARM" ;; cannam@85: mips*-*) FPM="MIPS" ;; cannam@85: sparc*-*) FPM="SPARC" ;; cannam@85: powerpc*-*) FPM="PPC" ;; cannam@85: # FIXME: need to test for 64-bit long long... cannam@85: esac cannam@85: fi cannam@85: cannam@85: AC_MSG_RESULT(${FPM=DEFAULT}) cannam@85: cannam@85: if test "$FPM" = "DEFAULT" cannam@85: then cannam@85: AC_MSG_WARN([default fixed-point math will yield limited accuracy]) cannam@85: fi cannam@85: cannam@85: FPM="-DFPM_$FPM" cannam@85: cannam@85: AC_ARG_ENABLE(sso, AC_HELP_STRING([--enable-sso], cannam@85: [use subband synthesis optimization]), cannam@85: [ cannam@85: case "$enableval" in cannam@85: yes) cannam@85: AC_DEFINE(OPT_SSO, 1, cannam@85: [Define to enable a fast subband synthesis approximation optimization.]) cannam@85: ;; cannam@85: esac cannam@85: ]) cannam@85: cannam@85: AC_ARG_ENABLE(aso, AC_HELP_STRING([--disable-aso], cannam@85: [disable architecture-specific optimizations]), cannam@85: [], [enable_aso=yes]) cannam@85: cannam@85: if test "$enable_aso" = yes cannam@85: then cannam@85: case "$host" in cannam@85: i?86-*) cannam@85: : #ASO="$ASO -DASO_INTERLEAVE1" cannam@85: ASO="$ASO -DASO_ZEROCHECK" cannam@85: : #not yet #ASO="$ASO -DASO_SYNTH" cannam@85: : #not yet #ASO_OBJS="synth_mmx.lo" cannam@85: ;; cannam@85: arm*-*) cannam@85: ASO="$ASO -DASO_INTERLEAVE1" cannam@85: ASO="$ASO -DASO_IMDCT" cannam@85: ASO_OBJS="imdct_l_arm.lo" cannam@85: ;; cannam@85: mips*-*) cannam@85: ASO="$ASO -DASO_INTERLEAVE2" cannam@85: ASO="$ASO -DASO_ZEROCHECK" cannam@85: ;; cannam@85: esac cannam@85: fi cannam@85: cannam@85: AC_MSG_CHECKING(for ISO/IEC interpretation) cannam@85: AC_ARG_ENABLE(strict-iso, AC_HELP_STRING([--enable-strict-iso], cannam@85: [use strict ISO/IEC interpretations]), cannam@85: [ cannam@85: case "$enableval" in cannam@85: yes) cannam@85: AC_DEFINE(OPT_STRICT, 1, cannam@85: [Define to influence a strict interpretation of the ISO/IEC standards, cannam@85: even if this is in opposition with best accepted practices.]) cannam@85: interpretation="strict" cannam@85: ;; cannam@85: esac cannam@85: ]) cannam@85: AC_MSG_RESULT(${interpretation-best accepted practices}) cannam@85: cannam@85: AC_MSG_CHECKING(whether to enable profiling) cannam@85: AC_ARG_ENABLE(profiling, AC_HELP_STRING([--enable-profiling], cannam@85: [generate profiling code]), cannam@85: [ cannam@85: case "$enableval" in cannam@85: yes) profile="-pg" ;; cannam@85: esac cannam@85: ]) cannam@85: AC_MSG_RESULT(${enable_profiling-no}) cannam@85: cannam@85: AC_MSG_CHECKING(whether to enable debugging) cannam@85: AC_ARG_ENABLE(debugging, AC_HELP_STRING([--enable-debugging], cannam@85: [enable diagnostic debugging support]) cannam@85: AC_HELP_STRING([--disable-debugging], cannam@85: [do not enable debugging and use more optimization]), cannam@85: [ cannam@85: case "$enableval" in cannam@85: yes) cannam@85: AC_DEFINE(DEBUG, 1, cannam@85: [Define to enable diagnostic debugging support.]) cannam@85: optimize="" cannam@85: ;; cannam@85: no) cannam@85: if test -n "$profile" cannam@85: then cannam@85: AC_MSG_ERROR(--enable-profiling and --disable-debugging are incompatible) cannam@85: fi cannam@85: cannam@85: AC_DEFINE(NDEBUG, 1, cannam@85: [Define to disable debugging assertions.]) cannam@85: debug="" cannam@85: if test "$GCC" = yes cannam@85: then cannam@85: optimize="$optimize -fomit-frame-pointer" cannam@85: fi cannam@85: ;; cannam@85: esac cannam@85: ]) cannam@85: AC_MSG_RESULT(${enable_debugging-default}) cannam@85: cannam@85: AC_MSG_CHECKING(whether to enable experimental code) cannam@85: AC_ARG_ENABLE(experimental, AC_HELP_STRING([--enable-experimental], cannam@85: [enable experimental code]), cannam@85: [ cannam@85: case "$enableval" in cannam@85: yes) cannam@85: AC_DEFINE(EXPERIMENTAL, 1, cannam@85: [Define to enable experimental code.]) cannam@85: ;; cannam@85: esac cannam@85: ]) cannam@85: AC_MSG_RESULT(${enable_experimental-no}) cannam@85: cannam@85: dnl Create output files. cannam@85: cannam@85: test -n "$arch" && CFLAGS="$CFLAGS $arch" cannam@85: test -n "$debug" && CFLAGS="$CFLAGS $debug" cannam@85: test -n "$optimize" && CFLAGS="$CFLAGS $optimize" cannam@85: test -n "$profile" && CFLAGS="$CFLAGS $profile" LDFLAGS="$LDFLAGS $profile" cannam@85: cannam@85: dnl LTLIBOBJS=`echo "$LIBOBJS" | sed -e 's/\.o/.lo/g'` cannam@85: dnl AC_SUBST(LTLIBOBJS) cannam@85: cannam@85: AC_CONFIG_FILES([Makefile msvc++/Makefile \ cannam@85: libmad.list]) cannam@85: AC_OUTPUT