1dnl -*- m4 -*- 2dnl 3dnl libmad - MPEG audio decoder library 4dnl Copyright (C) 2000-2004 Underbit Technologies, Inc. 5dnl 6dnl This program is free software; you can redistribute it and/or modify 7dnl it under the terms of the GNU General Public License as published by 8dnl the Free Software Foundation; either version 2 of the License, or 9dnl (at your option) any later version. 10dnl 11dnl This program is distributed in the hope that it will be useful, 12dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 13dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14dnl GNU General Public License for more details. 15dnl 16dnl You should have received a copy of the GNU General Public License 17dnl along with this program; if not, write to the Free Software 18dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19dnl 20AC_REVISION([$Id: configure.ac,v 1.9 2004/01/23 09:41:32 rob Exp $])dnl 21 22dnl Process this file with autoconf to produce a configure script. 23 24AC_INIT([MPEG Audio Decoder], [0.15.1b], [support@underbit.com], [libmad]) 25AC_PREREQ(2.53) 26 27AC_CONFIG_SRCDIR([decoder.h]) 28 29AM_INIT_AUTOMAKE 30 31AM_CONFIG_HEADER([config.h]) 32 33dnl System type. 34 35AC_CANONICAL_HOST 36 37dnl Checks for programs. 38 39AC_PROG_CC 40AM_PROG_AS 41 42if test "$GCC" = yes 43then 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 54dnl case "$host" in 55dnl *-*-cygwin* | *-*-mingw*) 56dnl LDFLAGS="$LDFLAGS -no-undefined -mdll" 57dnl ;; 58dnl esac 59fi 60 61dnl Support for libtool. 62 63dnl AC_DISABLE_SHARED 64dnl AC_LIBTOOL_WIN32_DLL 65AC_PROG_LIBTOOL 66 67AC_SUBST(LIBTOOL_DEPS) 68 69dnl Compiler options. 70 71arch="" 72debug="" 73optimize="" 74profile="" 75 76set -- $CFLAGS 77CFLAGS="" 78 79if test "$GCC" = yes 80then 81 CFLAGS="-Wall" 82fi 83 84while test $# -gt 0 85do 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 123done 124 125if test "$GCC" = yes 126then 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 192fi 193 194case "$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 ;; 203esac 204 205dnl Checks for header files. 206 207AC_HEADER_STDC 208AC_HEADER_SYS_WAIT 209AC_CHECK_HEADERS(assert.h limits.h unistd.h sys/types.h fcntl.h errno.h) 210 211dnl Checks for typedefs, structures, and compiler characteristics. 212 213AC_C_CONST 214AC_C_INLINE 215AC_C_BIGENDIAN 216AC_TYPE_PID_T 217 218AC_CHECK_SIZEOF(int, 2) 219AC_CHECK_SIZEOF(long, 4) 220AC_CHECK_SIZEOF(long long, 8) 221 222dnl Checks for library functions. 223 224AC_CHECK_FUNCS(waitpid fcntl pipe fork) 225 226dnl Other options. 227 228AC_SUBST(FPM) 229AC_SUBST(ASO) 230AC_SUBST(ASO_OBJS) 231 232dnl handle --enable and --disable options 233 234AC_CACHE_SAVE 235 236AC_MSG_CHECKING(whether to optimize for speed or for accuracy) 237 238AC_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 250AC_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 267AC_MSG_RESULT(${optimize_for-default}) 268 269if test "$optimize_for" = "both" 270then 271 AC_MSG_ERROR(cannot optimize for both speed and accuracy) 272fi 273 274AC_MSG_CHECKING(for architecture-specific fixed-point math routines) 275AC_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 296if test -z "$FPM" && test "$GCC" = yes 297then 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 306fi 307 308AC_MSG_RESULT(${FPM=DEFAULT}) 309 310if test "$FPM" = "DEFAULT" 311then 312 AC_MSG_WARN([default fixed-point math will yield limited accuracy]) 313fi 314 315FPM="-DFPM_$FPM" 316 317AC_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 328AC_ARG_ENABLE(aso, AC_HELP_STRING([--disable-aso], 329 [disable architecture-specific optimizations]), 330 [], [enable_aso=yes]) 331 332if test "$enable_aso" = yes 333then 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 351fi 352 353AC_MSG_CHECKING(for ISO/IEC interpretation) 354AC_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]) 366AC_MSG_RESULT(${interpretation-best accepted practices}) 367 368AC_MSG_CHECKING(whether to enable profiling) 369AC_ARG_ENABLE(profiling, AC_HELP_STRING([--enable-profiling], 370 [generate profiling code]), 371[ 372 case "$enableval" in 373 yes) profile="-pg" ;; 374 esac 375]) 376AC_MSG_RESULT(${enable_profiling-no}) 377 378AC_MSG_CHECKING(whether to enable debugging) 379AC_ARG_ENABLE(debugging, AC_HELP_STRING([--enable-debugging], 380 [enable diagnostic debugging support]) 381AC_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]) 406AC_MSG_RESULT(${enable_debugging-default}) 407 408AC_MSG_CHECKING(whether to enable experimental code) 409AC_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]) 419AC_MSG_RESULT(${enable_experimental-no}) 420 421dnl Create output files. 422 423test -n "$arch" && CFLAGS="$CFLAGS $arch" 424test -n "$debug" && CFLAGS="$CFLAGS $debug" 425test -n "$optimize" && CFLAGS="$CFLAGS $optimize" 426test -n "$profile" && CFLAGS="$CFLAGS $profile" LDFLAGS="$LDFLAGS $profile" 427 428dnl LTLIBOBJS=`echo "$LIBOBJS" | sed -e 's/\.o/.lo/g'` 429dnl AC_SUBST(LTLIBOBJS) 430 431AC_CONFIG_FILES([Makefile msvc++/Makefile \ 432 libmad.list]) 433AC_OUTPUT 434