blob: f106250280048593934812f01ca9fcd2387ca8d1 [file] [log] [blame]
Josh Coalson6b05bc52001-06-08 00:13:21 +00001# FLAC - Free Lossless Audio Codec
Josh Coalson1152f9f2002-01-26 18:05:12 +00002# Copyright (C) 2001,2002 Josh Coalson
Josh Coalson6b05bc52001-06-08 00:13:21 +00003#
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 Coalson0778b4d2001-12-04 02:20:43 +000022AM_INIT_AUTOMAKE(flac, 1.0.2)
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 Coalsonbb14ae82001-12-04 06:46:35 +000067AC_ARG_ENABLE(sse,
68[ --enable-sse Enable SSE support by asserting that the OS supports SSE instructions],
Josh Coalsond01b13a2001-07-18 00:27:06 +000069[case "${enableval}" in
70 yes) sse_os=true ;;
71 no) sse_os=false ;;
Josh Coalsonbb14ae82001-12-04 06:46:35 +000072 *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
Josh Coalsond01b13a2001-07-18 00:27:06 +000073esac],[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 Coalsonbb14ae82001-12-04 06:46:35 +000079AC_ARG_ENABLE(3dnow,
80[ --enable-3dnow Enable 3DNOW! support],
Josh Coalsonc69f8782001-11-13 23:08:22 +000081[case "${enableval}" in
82 yes) use_3dnow=true ;;
83 no) use_3dnow=false ;;
Josh Coalsonbb14ae82001-12-04 06:46:35 +000084 *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
Josh Coalsonc69f8782001-11-13 23:08:22 +000085esac],[use_3dnow=false])
86AM_CONDITIONAL(FLaC__USE_3DNOW, test x$use_3dnow = xtrue)
87if test x$use_3dnow = xtrue ; then
88AC_DEFINE(FLAC__USE_3DNOW)
89fi
90
Matt Zimmerman548175c2001-11-01 11:23:32 +000091AC_CHECK_LIB(ogg, ogg_stream_init,
92 [LIBS="$LIBS -logg"; have_ogg=yes],
93 [AC_MSG_WARN([*** Ogg development enviroment not installed - ogg support will not be built])])
Josh Coalsonc8a7d352001-11-11 03:59:46 +000094AM_CONDITIONAL(FLaC__HAS_OGG, [test x$have_ogg = xyes])
95if test x$have_ogg = xyes ; then
96AC_DEFINE(FLAC__HAS_OGG)
97fi
Josh Coalsonf7fc5c82001-10-31 18:31:36 +000098
Josh Coalson9f429ba2001-01-19 22:39:39 +000099AM_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 +0000100AM_CONDITIONAL(FLaC__HAS_XMMS, test x$XMMS_INPUT_PLUGIN_DIR != x)
101
102AC_CHECK_PROGS(NASM, nasm)
103AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
Josh Coalson0e3576e2001-05-25 00:07:51 +0000104if test -n "$NASM" ; then
105AC_DEFINE(FLAC__HAS_NASM)
106fi
Josh Coalson9f429ba2001-01-19 22:39:39 +0000107
Josh Coalson6ca4b1b2001-06-29 02:54:59 +0000108dnl Check for type sizes
109
110AC_CHECK_SIZEOF(short)
111AC_CHECK_SIZEOF(int)
112AC_CHECK_SIZEOF(long)
113AC_CHECK_SIZEOF(long long)
114
115case 2 in
116 $ac_cv_sizeof_short) FLaC__SIZE16="short" ; FLaC__USIZE16="unsigned short";;
117 $ac_cv_sizeof_int) FLaC__SIZE16="int" ; FLaC__USIZE16="unsigned int";;
118esac
119
120case 4 in
121 $ac_cv_sizeof_short) FLaC__SIZE32="short" ; FLaC__USIZE32="unsigned short";;
122 $ac_cv_sizeof_int) FLaC__SIZE32="int" ; FLaC__USIZE32="unsigned int";;
123 $ac_cv_sizeof_long) FLaC__SIZE32="long" ; FLaC__USIZE32="unsigned long";;
124esac
125
126case 8 in
127 $ac_cv_sizeof_int) FLaC__SIZE64="int" ; FLaC__USIZE64="unsigned int";;
128 $ac_cv_sizeof_long) FLaC__SIZE64="long" ; FLaC__USIZE64="unsigned long";;
129 $ac_cv_sizeof_long_long) FLaC__SIZE64="long long" ; FLaC__USIZE64="unsigned long long";;
130esac
131
132if test -z "$FLaC__SIZE16"; then
133 AC_MSG_ERROR(No 16 bit type found on this platform!)
134fi
135if test -z "$FLaC__USIZE16"; then
136 AC_MSG_ERROR(No unsigned 16 bit type found on this platform!)
137fi
138if test -z "$FLaC__SIZE32"; then
139 AC_MSG_ERROR(No 32 bit type found on this platform!)
140fi
141if test -z "$FLaC__USIZE32"; then
142 AC_MSG_ERROR(No unsigned 32 bit type found on this platform!)
143fi
144if test -z "$FLaC__SIZE64"; then
145 AC_MSG_WARN(No 64 bit type found on this platform!)
146fi
147if test -z "$FLaC__USIZE64"; then
148 AC_MSG_ERROR(No unsigned 64 bit type found on this platform!)
149fi
150
151AC_SUBST(FLaC__SIZE16)
152AC_SUBST(FLaC__USIZE16)
153AC_SUBST(FLaC__SIZE32)
154AC_SUBST(FLaC__USIZE32)
155AC_SUBST(FLaC__SIZE64)
156AC_SUBST(FLaC__USIZE64)
157
Josh Coalson9ea7e2c2001-07-19 00:19:25 +0000158SAVE_CFLAGS="$CFLAGS"
Matt Zimmermande0c6542002-01-14 23:17:37 +0000159CFLAGS='-I$(top_builddir) -I$(srcdir)/include -I $(top_srcdir)/include -I$(top_builddir)/include/FLAC'
Josh Coalson9f429ba2001-01-19 22:39:39 +0000160if test x$debug = xtrue; then
Josh Coalson51f2bbf2001-07-19 00:22:47 +0000161 CFLAGS="$CFLAGS -g -O0 -DDEBUG"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000162else
Josh Coalson51f2bbf2001-07-19 00:22:47 +0000163 CFLAGS="$CFLAGS -O3 -DNDEBUG"
Josh Coalsonda0adb22001-06-18 23:07:19 +0000164 if test x$GCC = xyes; then
Matt Zimmermande0c6542002-01-14 23:17:37 +0000165 CFLAGS="$CFLAGS -fomit-frame-pointer -funroll-loops -finline-functions -Wall -W -Winline -DFLaC__INLINE=__inline__"
Josh Coalsonda0adb22001-06-18 23:07:19 +0000166 fi
Josh Coalson9f429ba2001-01-19 22:39:39 +0000167fi
Josh Coalson9ea7e2c2001-07-19 00:19:25 +0000168CFLAGS="$CFLAGS $SAVE_CFLAGS"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000169
170AC_OUTPUT( Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000171 src/Makefile \
172 src/libFLAC/Makefile \
173 src/libFLAC/ia32/Makefile \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000174 src/libFLAC/include/Makefile \
175 src/libFLAC/include/private/Makefile \
176 src/libFLAC/include/protected/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000177 src/flac/Makefile \
178 src/metaflac/Makefile \
179 src/plugin_xmms/Makefile \
180 src/test_streams/Makefile \
181 src/test_unit/Makefile \
182 include/Makefile \
183 include/FLAC/Makefile \
Josh Coalson6ca4b1b2001-06-29 02:54:59 +0000184 include/FLAC/ordinals.h \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000185 doc/Makefile \
186 doc/images/Makefile \
187 doc/ru/Makefile \
188 man/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000189 test/Makefile \
190)