blob: 1c8ecc0886234c2ebdaf5c8cc6ab988b3642fb50 [file] [log] [blame]
Josh Coalson6b05bc52001-06-08 00:13:21 +00001# FLAC - Free Lossless Audio Codec
2# Copyright (C) 2001 Josh Coalson
3#
4# This program is part of FLAC; you can redistribute it and/or
5# modify it under the terms of the GNU General Public License
6# as published by the Free Software Foundation; either version 2
7# of the License, or (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
Josh Coalson0e3576e2001-05-25 00:07:51 +000018# NOTE that for many of the AM_CONDITIONALs we use the prefix FLaC__
Josh Coalsoncf030c82001-05-23 20:59:48 +000019# instead of FLAC__ since autoconf triggers off 'AC_' in strings
20
Josh Coalson9f429ba2001-01-19 22:39:39 +000021AC_INIT(src/flac/main.c)
Josh Coalson4ac98232001-06-23 03:04:32 +000022AM_INIT_AUTOMAKE(flac, 1.0)
Josh Coalson9f429ba2001-01-19 22:39:39 +000023
24# We need two libtools, one that builds both shared and static, and
25# one that builds only static. This is because the resulting libtool
26# does not allow us to choose which to build at runtime.
27AM_PROG_LIBTOOL
28sed -e 's/^build_old_libs=yes/build_old_libs=no/' libtool > libtool-disable-static
29chmod +x libtool-disable-static
30
31AC_PROG_MAKE_SET
32
Josh Coalsondef8eb82001-05-23 22:08:27 +000033AC_CANONICAL_HOST
34case $host_cpu in
Josh Coalson0e3576e2001-05-25 00:07:51 +000035 i*86) cpu_ia32=true ; AC_DEFINE(FLAC__CPU_IA32) ;;
36 powerpc) cpu_ppc=true ; AC_DEFINE(FLAC__CPU_PPC) ;;
37 sparc) cpu_sparc=true ; AC_DEFINE(FLAC__CPU_SPARC) ;;
Josh Coalsoncf030c82001-05-23 20:59:48 +000038esac
39AM_CONDITIONAL(FLaC__CPU_IA32, test x$cpu_ia32 = xtrue)
40AM_CONDITIONAL(FLaC__CPU_PPC, test x$cpu_ppc = xtrue)
41AM_CONDITIONAL(FLaC__CPU_SPARC, test x$cpu_sparc = xtrue)
Josh Coalsonda0adb22001-06-18 23:07:19 +000042case "$host" in
Josh Coalson4ca5ec92001-08-13 21:58:49 +000043 i[[3-6]]86-*-openbsd*) OBJ_FORMAT=aoutb ;;
Josh Coalsonda0adb22001-06-18 23:07:19 +000044 *) OBJ_FORMAT=elf ;;
45esac
46AC_SUBST(OBJ_FORMAT)
Josh Coalsoncf030c82001-05-23 20:59:48 +000047
Josh Coalson0e3576e2001-05-25 00:07:51 +000048if test x$cpu_ia32 = xtrue ; then
49AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
50fi
Josh Coalsoncf030c82001-05-23 20:59:48 +000051
52AC_ARG_ENABLE(asm-optimizations, [ --disable-asm-optimizations Don't use any assembly optimization routines], asm_opt=no, asm_opt=yes)
53AM_CONDITIONAL(FLaC__NO_ASM, test x$asm_opt = xno)
Josh Coalson0e3576e2001-05-25 00:07:51 +000054if test x$asm_opt = xno ; then
55AC_DEFINE(FLAC__NO_ASM)
56fi
Josh Coalsoncf030c82001-05-23 20:59:48 +000057
Josh Coalson9f429ba2001-01-19 22:39:39 +000058AC_ARG_ENABLE(debug,
Josh Coalsonda0adb22001-06-18 23:07:19 +000059[ --enable-debug Turn on debugging],
60[case "${enableval}" in
61 yes) debug=true ;;
62 no) debug=false ;;
63 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
64esac],[debug=false])
Josh Coalson9f429ba2001-01-19 22:39:39 +000065AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
66
Josh Coalsond01b13a2001-07-18 00:27:06 +000067AC_ARG_ENABLE(sse_os,
68[ --sse-os Enable SSE support by asserting that the OS supports SSE instructions],
69[case "${enableval}" in
70 yes) sse_os=true ;;
71 no) sse_os=false ;;
72 *) AC_MSG_ERROR(bad value ${enableval} for --sse-os) ;;
73esac],[sse_os=false])
74AM_CONDITIONAL(FLaC__SSE_OS, test x$sse_os = xtrue)
75if test x$sse_os = xtrue ; then
76AC_DEFINE(FLAC__SSE_OS)
77fi
78
Josh Coalsonf7fc5c82001-10-31 18:31:36 +000079AM_PATH_OGG( , AC_MSG_WARN([*** Ogg development enviroment not installed - ogg support will not be built]))
80AM_CONDITIONAL(FLaC__HAS_OGG, test x$OGG_LIBS != x)
81
Josh Coalson9f429ba2001-01-19 22:39:39 +000082AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - xmms support will not be built]))
Josh Coalsoncf030c82001-05-23 20:59:48 +000083AM_CONDITIONAL(FLaC__HAS_XMMS, test x$XMMS_INPUT_PLUGIN_DIR != x)
84
85AC_CHECK_PROGS(NASM, nasm)
86AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
Josh Coalson0e3576e2001-05-25 00:07:51 +000087if test -n "$NASM" ; then
88AC_DEFINE(FLAC__HAS_NASM)
89fi
Josh Coalson9f429ba2001-01-19 22:39:39 +000090
Josh Coalson6ca4b1b2001-06-29 02:54:59 +000091dnl Check for type sizes
92
93AC_CHECK_SIZEOF(short)
94AC_CHECK_SIZEOF(int)
95AC_CHECK_SIZEOF(long)
96AC_CHECK_SIZEOF(long long)
97
98case 2 in
99 $ac_cv_sizeof_short) FLaC__SIZE16="short" ; FLaC__USIZE16="unsigned short";;
100 $ac_cv_sizeof_int) FLaC__SIZE16="int" ; FLaC__USIZE16="unsigned int";;
101esac
102
103case 4 in
104 $ac_cv_sizeof_short) FLaC__SIZE32="short" ; FLaC__USIZE32="unsigned short";;
105 $ac_cv_sizeof_int) FLaC__SIZE32="int" ; FLaC__USIZE32="unsigned int";;
106 $ac_cv_sizeof_long) FLaC__SIZE32="long" ; FLaC__USIZE32="unsigned long";;
107esac
108
109case 8 in
110 $ac_cv_sizeof_int) FLaC__SIZE64="int" ; FLaC__USIZE64="unsigned int";;
111 $ac_cv_sizeof_long) FLaC__SIZE64="long" ; FLaC__USIZE64="unsigned long";;
112 $ac_cv_sizeof_long_long) FLaC__SIZE64="long long" ; FLaC__USIZE64="unsigned long long";;
113esac
114
115if test -z "$FLaC__SIZE16"; then
116 AC_MSG_ERROR(No 16 bit type found on this platform!)
117fi
118if test -z "$FLaC__USIZE16"; then
119 AC_MSG_ERROR(No unsigned 16 bit type found on this platform!)
120fi
121if test -z "$FLaC__SIZE32"; then
122 AC_MSG_ERROR(No 32 bit type found on this platform!)
123fi
124if test -z "$FLaC__USIZE32"; then
125 AC_MSG_ERROR(No unsigned 32 bit type found on this platform!)
126fi
127if test -z "$FLaC__SIZE64"; then
128 AC_MSG_WARN(No 64 bit type found on this platform!)
129fi
130if test -z "$FLaC__USIZE64"; then
131 AC_MSG_ERROR(No unsigned 64 bit type found on this platform!)
132fi
133
134AC_SUBST(FLaC__SIZE16)
135AC_SUBST(FLaC__USIZE16)
136AC_SUBST(FLaC__SIZE32)
137AC_SUBST(FLaC__USIZE32)
138AC_SUBST(FLaC__SIZE64)
139AC_SUBST(FLaC__USIZE64)
140
Josh Coalson9ea7e2c2001-07-19 00:19:25 +0000141SAVE_CFLAGS="$CFLAGS"
Josh Coalson0a688902001-07-22 19:02:40 +0000142CFLAGS='-I$(top_builddir) -I$(srcdir)/include -I $(top_srcdir)/include -Wall -W'
Josh Coalson9f429ba2001-01-19 22:39:39 +0000143if test x$debug = xtrue; then
Josh Coalson51f2bbf2001-07-19 00:22:47 +0000144 CFLAGS="$CFLAGS -g -O0 -DDEBUG"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000145else
Josh Coalson51f2bbf2001-07-19 00:22:47 +0000146 CFLAGS="$CFLAGS -O3 -DNDEBUG"
Josh Coalsonda0adb22001-06-18 23:07:19 +0000147 if test x$GCC = xyes; then
Josh Coalson9bab0412001-07-20 23:44:35 +0000148 CFLAGS="$CFLAGS -fomit-frame-pointer -funroll-loops -finline-functions -Winline -DFLaC__INLINE=__inline__"
Josh Coalsonda0adb22001-06-18 23:07:19 +0000149 fi
Josh Coalson9f429ba2001-01-19 22:39:39 +0000150fi
Josh Coalson9ea7e2c2001-07-19 00:19:25 +0000151CFLAGS="$CFLAGS $SAVE_CFLAGS"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000152
153AC_OUTPUT( Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000154 src/Makefile \
155 src/libFLAC/Makefile \
156 src/libFLAC/ia32/Makefile \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000157 src/libFLAC/include/Makefile \
158 src/libFLAC/include/private/Makefile \
159 src/libFLAC/include/protected/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000160 src/flac/Makefile \
161 src/metaflac/Makefile \
162 src/plugin_xmms/Makefile \
163 src/test_streams/Makefile \
164 src/test_unit/Makefile \
165 include/Makefile \
166 include/FLAC/Makefile \
Josh Coalson6ca4b1b2001-06-29 02:54:59 +0000167 include/FLAC/ordinals.h \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000168 doc/Makefile \
169 doc/images/Makefile \
170 doc/ru/Makefile \
171 man/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000172 test/Makefile \
173)