1dnl Process this file with autoconf to produce a configure script.
2AC_PREREQ(2.52)
3AC_INIT
4AC_CONFIG_SRCDIR([src/a52dec.c])
5AC_CONFIG_AUX_DIR(autotools)
6AC_CONFIG_FILES([Makefile autotools/Makefile include/Makefile test/Makefile
7    doc/Makefile src/Makefile liba52/Makefile libao/Makefile vc++/Makefile])
8AM_INIT_AUTOMAKE([a52dec],[0.7.4])
9AM_CONFIG_HEADER(include/config.h)
10AM_MAINTAINER_MODE
11AC_CANONICAL_HOST
12
13dnl Checks for compiler
14AC_PROG_CC
15AC_PROG_GCC_TRADITIONAL
16
17if test x"$GCC" = x"yes"; then
18
19    dnl GCC-specific flags - try to optimize them sometime
20    dnl -Wall -Werror moved to the end to not disturb the configure script
21
22    dnl -O3
23    changequote(<<,>>)
24    OPT_CFLAGS=`echo "$CFLAGS"|sed "s/-O[0-9]*//g"`
25    changequote([,])
26    OPT_CFLAGS="$OPT_CFLAGS -O3"
27    AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS])
28
29    dnl -fomit-frame-pointer
30    OPT_CFLAGS="$CFLAGS -fomit-frame-pointer"
31    AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS])
32
33    dnl arch-specific flags
34    case "$host" in
35    i?86-* | k?-*)
36	case "$host" in
37	i386-*) OPT_CFLAGS="$CFLAGS -mcpu=i386";;
38	i486-*) OPT_CFLAGS="$CFLAGS -mcpu=i486";;
39	i586-*) OPT_CFLAGS="$CFLAGS -mcpu=pentium";;
40	i686-*) OPT_CFLAGS="$CFLAGS -mcpu=pentiumpro";;
41	k6-*)   OPT_CFLAGS="$CFLAGS -mcpu=k6";;
42	esac
43	AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS]);;
44    sparc-* | sparc64-*)
45	OPT_CFLAGS="$CFLAGS -mtune=ultrasparc"
46	AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS]);;
47    mips-sgi-irix6.*)	dnl do we need to be that specific ?
48	OPT_CFLAGS="$CFLAGS -mabi=64"
49	AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS]);;
50    esac
51elif test x"$CC" = x"tcc" -a x"`$CC -version 2>&1 | grep TenDRA`" != x""; then
52    dnl TenDRA portability checking compiler
53    TENDRA=yes
54    CFLAGS="-Xp -Yansi -f`pwd`/include/tendra.h -DELIDE_CODE"
55    enable_mlib=no
56    enable_oss=no
57    enable_solaris_audio=no
58elif test x"$CC" = x"icc" -a x"`$CC -V 2>&1 | grep Intel`" != x""; then
59    dnl Intel C++ compiler
60    CFLAGS="-g -O3 -unroll -ip"
61else
62    dnl non-gcc flags - we probably need exact configuration triplets here.
63    case "$host" in
64    mips-sgi-irix6.*)
65	OPT_CFLAGS="$CFLAGS -64"
66	AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS]);;
67    sparc-sun-solaris*)
68	OPT_CFLAGS="$CFLAGS -xCC -fast -xO5"
69	AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS]);;
70    esac
71fi
72
73dnl Checks for libtool - this must be done after we set cflags
74AC_DISABLE_SHARED
75AC_LIBTOOL_WIN32_DLL
76AC_PROG_LIBTOOL
77
78dnl Checks for libraries.
79
80dnl Checks for header files.
81INCLUDES='-I$(top_srcdir)/include -I$(top_builddir)/include'
82AC_SUBST([INCLUDES])
83AC_CHECK_HEADERS([sys/time.h sys/timeb.h io.h])
84AC_CHECK_GENERATE_INTTYPES([include])
85
86dnl Checks for typedefs, structures, and compiler characteristics.
87AC_C_CONST
88AC_C_ALWAYS_INLINE
89AC_C_RESTRICT
90AC_TYPE_SIZE_T
91AC_C_BIGENDIAN
92
93dnl Checks for library functions.
94AC_CHECK_FUNCS([memalign gettimeofday ftime])
95AC_TYPE_SIGNAL
96
97builtin([include],[liba52/configure.incl])
98builtin([include],[libao/configure.incl])
99
100AC_ARG_ENABLE([warnings],
101    [  --enable-warnings       treat warnings as errors])
102if test x"$enable_warnings" = x"yes" -a x"$GCC" = x"yes"; then
103    dnl compiler warnings
104    OPT_CFLAGS="$CFLAGS -Wall -Werror"
105    AC_TRY_CFLAGS([$OPT_CFLAGS],[CFLAGS=$OPT_CFLAGS])
106elif test x"$TENDRA" = x"yes"; then
107    dnl TenDRA portability checking compiler
108    CFLAGS="$CFLAGS -DTenDRA_check"
109fi
110
111builtin([include],[src/configure.incl])
112
113AC_C_ATTRIBUTE_ALIGNED
114
115AC_OUTPUT
116