discriminate by cpu, check for nasm, add option for disabling asm optimizations
[flac.git] / configure.in
1 # note that for many of the conditionals we use the prefix FLaC__
2 # instead of FLAC__ since autoconf triggers off 'AC_' in strings
3
4 AC_INIT(src/flac/main.c)
5 AM_INIT_AUTOMAKE(flac, 0.9)
6
7 # We need two libtools, one that builds both shared and static, and
8 # one that builds only static.  This is because the resulting libtool
9 # does not allow us to choose which to build at runtime.
10 AM_PROG_LIBTOOL
11 sed -e 's/^build_old_libs=yes/build_old_libs=no/' libtool > libtool-disable-static
12 chmod +x libtool-disable-static
13
14 AC_PROG_MAKE_SET
15
16 AC_CANONICAL_TARGET
17 case $target_cpu in
18         i*86)   cpu_ia32=true ;;
19         powerpc)        cpu_ppc=true ;;
20         sparc)  cpu_sparc=true ;;
21 esac
22 AM_CONDITIONAL(FLaC__CPU_IA32, test x$cpu_ia32 = xtrue)
23 AM_CONDITIONAL(FLaC__CPU_PPC, test x$cpu_ppc = xtrue)
24 AM_CONDITIONAL(FLaC__CPU_SPARC, test x$cpu_sparc = xtrue)
25
26 AM_CONDITIONAL(FLaC__ALIGN_MALLOC_DATA, test x$cpu_ia32 = xtrue)
27
28 AC_ARG_ENABLE(asm-optimizations, [  --disable-asm-optimizations    Don't use any assembly optimization routines], asm_opt=no, asm_opt=yes)
29 AM_CONDITIONAL(FLaC__NO_ASM, test x$asm_opt = xno)
30
31 AC_ARG_ENABLE(debug,
32         [  --enable-debug                 Turn on debugging],
33         [case "${enableval}" in
34                 yes) debug=true ;;
35                 no)  debug=false ;;
36                 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
37         esac],[debug=false])
38 AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
39
40 AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - xmms support will not be built]))
41 AM_CONDITIONAL(FLaC__HAS_XMMS, test x$XMMS_INPUT_PLUGIN_DIR != x)
42
43 AC_CHECK_PROGS(NASM, nasm)
44 AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
45
46 CFLAGS='-I./include -I $(top_srcdir)/include -Wall -W'
47 if test x$debug = xtrue; then
48   CFLAGS="$CFLAGS  -g -O0 -DDEBUG"
49 else
50   CFLAGS="$CFLAGS -O3 -fomit-frame-pointer -funroll-loops -ffast-math -finline-functions -DNDEBUG"
51 fi
52
53 AC_OUTPUT(      Makefile        \
54                 src/Makefile    \
55                 src/libFLAC/Makefile    \
56                 src/flac/Makefile       \
57                 src/metaflac/Makefile   \
58                 src/plugin_xmms/Makefile        \
59                 src/test_streams/Makefile       \
60                 src/test_unit/Makefile  \
61                 test/Makefile   \
62                 )