blob: b6c3c82b9d1c5b24051dccdcdedc9710afc13960 [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 Coalson0d0d7732002-07-02 22:23:55 +000022AM_INIT_AUTOMAKE(flac, 1.0.3)
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
Josh Coalson57ba6f42002-06-07 05:27:37 +000031AC_PROG_CXX
Josh Coalson9f429ba2001-01-19 22:39:39 +000032AC_PROG_MAKE_SET
33
Josh Coalson5a804ca2002-05-17 06:08:13 +000034dnl check for getopt in standard library
35dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
36AC_CHECK_FUNCS(getopt_long, [], [])
37
Josh Coalsondef8eb82001-05-23 22:08:27 +000038AC_CANONICAL_HOST
Josh Coalson5a804ca2002-05-17 06:08:13 +000039case "$host_cpu" in
Josh Coalson0e3576e2001-05-25 00:07:51 +000040 i*86) cpu_ia32=true ; AC_DEFINE(FLAC__CPU_IA32) ;;
41 powerpc) cpu_ppc=true ; AC_DEFINE(FLAC__CPU_PPC) ;;
42 sparc) cpu_sparc=true ; AC_DEFINE(FLAC__CPU_SPARC) ;;
Josh Coalsoncf030c82001-05-23 20:59:48 +000043esac
44AM_CONDITIONAL(FLaC__CPU_IA32, test x$cpu_ia32 = xtrue)
45AM_CONDITIONAL(FLaC__CPU_PPC, test x$cpu_ppc = xtrue)
46AM_CONDITIONAL(FLaC__CPU_SPARC, test x$cpu_sparc = xtrue)
Josh Coalsonda0adb22001-06-18 23:07:19 +000047case "$host" in
Josh Coalson4ca5ec92001-08-13 21:58:49 +000048 i[[3-6]]86-*-openbsd*) OBJ_FORMAT=aoutb ;;
Josh Coalsonda0adb22001-06-18 23:07:19 +000049 *) OBJ_FORMAT=elf ;;
50esac
51AC_SUBST(OBJ_FORMAT)
Josh Coalsoncf030c82001-05-23 20:59:48 +000052
Josh Coalson0e3576e2001-05-25 00:07:51 +000053if test x$cpu_ia32 = xtrue ; then
54AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
55fi
Josh Coalsoncf030c82001-05-23 20:59:48 +000056
57AC_ARG_ENABLE(asm-optimizations, [ --disable-asm-optimizations Don't use any assembly optimization routines], asm_opt=no, asm_opt=yes)
58AM_CONDITIONAL(FLaC__NO_ASM, test x$asm_opt = xno)
Josh Coalson0e3576e2001-05-25 00:07:51 +000059if test x$asm_opt = xno ; then
60AC_DEFINE(FLAC__NO_ASM)
61fi
Josh Coalsoncf030c82001-05-23 20:59:48 +000062
Josh Coalson9f429ba2001-01-19 22:39:39 +000063AC_ARG_ENABLE(debug,
Josh Coalsonda0adb22001-06-18 23:07:19 +000064[ --enable-debug Turn on debugging],
65[case "${enableval}" in
66 yes) debug=true ;;
67 no) debug=false ;;
68 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
69esac],[debug=false])
Josh Coalson9f429ba2001-01-19 22:39:39 +000070AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
71
Josh Coalsonbb14ae82001-12-04 06:46:35 +000072AC_ARG_ENABLE(sse,
73[ --enable-sse Enable SSE support by asserting that the OS supports SSE instructions],
Josh Coalsond01b13a2001-07-18 00:27:06 +000074[case "${enableval}" in
75 yes) sse_os=true ;;
76 no) sse_os=false ;;
Josh Coalsonbb14ae82001-12-04 06:46:35 +000077 *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
Josh Coalsond01b13a2001-07-18 00:27:06 +000078esac],[sse_os=false])
79AM_CONDITIONAL(FLaC__SSE_OS, test x$sse_os = xtrue)
80if test x$sse_os = xtrue ; then
81AC_DEFINE(FLAC__SSE_OS)
82fi
83
Josh Coalsonbb14ae82001-12-04 06:46:35 +000084AC_ARG_ENABLE(3dnow,
85[ --enable-3dnow Enable 3DNOW! support],
Josh Coalsonc69f8782001-11-13 23:08:22 +000086[case "${enableval}" in
87 yes) use_3dnow=true ;;
88 no) use_3dnow=false ;;
Josh Coalsonbb14ae82001-12-04 06:46:35 +000089 *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
Josh Coalsonc69f8782001-11-13 23:08:22 +000090esac],[use_3dnow=false])
91AM_CONDITIONAL(FLaC__USE_3DNOW, test x$use_3dnow = xtrue)
92if test x$use_3dnow = xtrue ; then
93AC_DEFINE(FLAC__USE_3DNOW)
94fi
95
Josh Coalson49912902002-06-28 23:45:08 +000096AM_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development enviroment not installed - Ogg support will not be built]))
Josh Coalsonc8a7d352001-11-11 03:59:46 +000097AM_CONDITIONAL(FLaC__HAS_OGG, [test x$have_ogg = xyes])
98if test x$have_ogg = xyes ; then
99AC_DEFINE(FLAC__HAS_OGG)
100fi
Josh Coalsonf7fc5c82001-10-31 18:31:36 +0000101
Josh Coalson9f429ba2001-01-19 22:39:39 +0000102AM_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 +0000103AM_CONDITIONAL(FLaC__HAS_XMMS, test x$XMMS_INPUT_PLUGIN_DIR != x)
104
Josh Coalson5a804ca2002-05-17 06:08:13 +0000105SHARE_LIBS='$(top_builddir)/src/share/libutf8.a $(top_builddir)/src/share/libgetopt.a'
106
Josh Coalson130cbb52002-07-16 16:12:27 +0000107dnl check for i18n(internationalization); these are from libiconv/gettext
Josh Coalson412fa3b2002-07-11 06:15:30 +0000108AM_ICONV
109AM_LANGINFO_CODESET
110
Josh Coalson130cbb52002-07-16 16:12:27 +0000111dnl check id3lib libraries
Josh Coalson412fa3b2002-07-11 06:15:30 +0000112LIBS_save_blah_blah_blah=$LIBS
113LIBS=""
114AC_SEARCH_LIBS(ID3Tag_Link,"id3" "id3 -lstdc++" "id3 -lz" "id3 -lz -lstdc++",
115 [have_id3lib=yes],
116 [AC_MSG_WARN([id3lib not found - ID3v2 will not be supported, internal function support only id3v1])])
117AM_CONDITIONAL(FLaC__HAS_ID3LIB, [test x$have_id3lib = xyes])
118if test x$have_id3lib = xyes ; then
119AC_DEFINE(FLAC__HAS_ID3LIB)
120ID3LIBS=$LIBS
121fi
122AC_SUBST(ID3LIBS)
123
124dnl expected version for cross compiling
125ID3LIB_MAJOR=3
126ID3LIB_MINOR=8
127ID3LIB_PATCH=0
128
129AC_MSG_CHECKING(for id3lib version)
130 AC_TRY_RUN([
131#include <id3.h>
132#include <stdio.h>
133int
134main ()
135{
136 FILE *output;
137 output=fopen("conftest.id3","w");
138 fprintf(output,"ID3LIB_MAJOR=%d\nID3LIB_MINOR=%d\nID3LIB_PATCH=%d\n",ID3LIB_MAJOR_VERSION,ID3LIB_MINOR_VERSION,ID3LIB_PATCH_VERSION);
139 fclose(output);
140 exit(0);
141}
142], . conftest.id3; echo "${ID3LIB_MAJOR}.${ID3LIB_MINOR}.${ID3LIB_PATCH}", AC_MSG_WARN(could not determine id3lib version),[echo $ac_n "cross compiling; assuming ${ID3LIB_MAJOR}.${ID3LIB_MINOR}.${ID3LIB_PATCH} $ac_c"])
143AC_DEFINE_UNQUOTED(ID3LIB_MAJOR, $ID3LIB_MAJOR)
144AC_DEFINE_UNQUOTED(ID3LIB_MINOR, $ID3LIB_MINOR)
145AC_DEFINE_UNQUOTED(ID3LIB_PATCH, $ID3LIB_PATCH)
146
147LIBS=$LIBS_save_blah_blah_blah
148
Josh Coalsoncf030c82001-05-23 20:59:48 +0000149AC_CHECK_PROGS(NASM, nasm)
150AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
Josh Coalson0e3576e2001-05-25 00:07:51 +0000151if test -n "$NASM" ; then
152AC_DEFINE(FLAC__HAS_NASM)
153fi
Josh Coalson9f429ba2001-01-19 22:39:39 +0000154
Josh Coalson6ca4b1b2001-06-29 02:54:59 +0000155dnl Check for type sizes
156
157AC_CHECK_SIZEOF(short)
158AC_CHECK_SIZEOF(int)
159AC_CHECK_SIZEOF(long)
160AC_CHECK_SIZEOF(long long)
161
162case 2 in
163 $ac_cv_sizeof_short) FLaC__SIZE16="short" ; FLaC__USIZE16="unsigned short";;
164 $ac_cv_sizeof_int) FLaC__SIZE16="int" ; FLaC__USIZE16="unsigned int";;
165esac
166
167case 4 in
168 $ac_cv_sizeof_short) FLaC__SIZE32="short" ; FLaC__USIZE32="unsigned short";;
169 $ac_cv_sizeof_int) FLaC__SIZE32="int" ; FLaC__USIZE32="unsigned int";;
170 $ac_cv_sizeof_long) FLaC__SIZE32="long" ; FLaC__USIZE32="unsigned long";;
171esac
172
173case 8 in
174 $ac_cv_sizeof_int) FLaC__SIZE64="int" ; FLaC__USIZE64="unsigned int";;
175 $ac_cv_sizeof_long) FLaC__SIZE64="long" ; FLaC__USIZE64="unsigned long";;
176 $ac_cv_sizeof_long_long) FLaC__SIZE64="long long" ; FLaC__USIZE64="unsigned long long";;
177esac
178
179if test -z "$FLaC__SIZE16"; then
180 AC_MSG_ERROR(No 16 bit type found on this platform!)
181fi
182if test -z "$FLaC__USIZE16"; then
183 AC_MSG_ERROR(No unsigned 16 bit type found on this platform!)
184fi
185if test -z "$FLaC__SIZE32"; then
186 AC_MSG_ERROR(No 32 bit type found on this platform!)
187fi
188if test -z "$FLaC__USIZE32"; then
189 AC_MSG_ERROR(No unsigned 32 bit type found on this platform!)
190fi
191if test -z "$FLaC__SIZE64"; then
192 AC_MSG_WARN(No 64 bit type found on this platform!)
193fi
194if test -z "$FLaC__USIZE64"; then
195 AC_MSG_ERROR(No unsigned 64 bit type found on this platform!)
196fi
197
198AC_SUBST(FLaC__SIZE16)
199AC_SUBST(FLaC__USIZE16)
200AC_SUBST(FLaC__SIZE32)
201AC_SUBST(FLaC__USIZE32)
202AC_SUBST(FLaC__SIZE64)
203AC_SUBST(FLaC__USIZE64)
204
Josh Coalson5a804ca2002-05-17 06:08:13 +0000205AC_SUBST(SHARE_LIBS)
206
Josh Coalson57ba6f42002-06-07 05:27:37 +0000207OUR_CFLAGS_HEAD='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'
Josh Coalson9f429ba2001-01-19 22:39:39 +0000208if test x$debug = xtrue; then
Josh Coalson57ba6f42002-06-07 05:27:37 +0000209 OUR_CFLAGS_TAIL="-g -O0 -DDEBUG"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000210else
Josh Coalson57ba6f42002-06-07 05:27:37 +0000211 OUR_CFLAGS_TAIL="-O3 -DNDEBUG"
Josh Coalsonda0adb22001-06-18 23:07:19 +0000212 if test x$GCC = xyes; then
Josh Coalson57ba6f42002-06-07 05:27:37 +0000213 OUR_CFLAGS_TAIL="$OUR_CFLAGS_TAIL -fomit-frame-pointer -funroll-loops -finline-functions -Wall -W -Winline -DFLaC__INLINE=__inline__"
Josh Coalsonda0adb22001-06-18 23:07:19 +0000214 fi
Josh Coalson9f429ba2001-01-19 22:39:39 +0000215fi
Josh Coalson57ba6f42002-06-07 05:27:37 +0000216CFLAGS="$OUR_CFLAGS_HEAD $CFLAGS $OUR_CFLAGS_TAIL"
217CXXFLAGS="$OUR_CFLAGS_HEAD $CXXFLAGS $OUR_CFLAGS_TAIL"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000218
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000219AC_OUTPUT( \
220 Makefile \
221 src/Makefile \
222 src/libFLAC/Makefile \
223 src/libFLAC/ia32/Makefile \
224 src/libFLAC/include/Makefile \
225 src/libFLAC/include/private/Makefile \
226 src/libFLAC/include/protected/Makefile \
227 src/libFLAC++/Makefile \
Josh Coalsonc49380d2002-08-07 17:38:08 +0000228 src/libOggFLAC/Makefile \
229 src/libOggFLAC/include/Makefile \
230 src/libOggFLAC/include/protected/Makefile \
231 src/libOggFLAC++/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000232 src/flac/Makefile \
233 src/metaflac/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000234 src/monkeys_audio_utilities/flac_mac/Makefile \
235 src/monkeys_audio_utilities/flac_ren/Makefile \
236 src/monkeys_audio_utilities/Makefile \
237 src/plugin_common/Makefile \
238 src/plugin_winamp2/Makefile \
239 src/plugin_winamp3/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000240 src/plugin_xmms/Makefile \
241 src/share/Makefile \
242 src/test_libFLAC/Makefile \
243 src/test_libFLAC++/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000244 src/test_libOggFLAC/Makefile \
245 src/test_libOggFLAC++/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000246 src/test_streams/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000247 include/Makefile \
248 include/FLAC/Makefile \
Josh Coalson6ca4b1b2001-06-29 02:54:59 +0000249 include/FLAC/ordinals.h \
Josh Coalson5a804ca2002-05-17 06:08:13 +0000250 include/FLAC++/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000251 include/OggFLAC/Makefile \
252 include/OggFLAC++/Makefile \
Josh Coalson5a804ca2002-05-17 06:08:13 +0000253 include/share/Makefile \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000254 doc/Makefile \
Josh Coalson130cbb52002-07-16 16:12:27 +0000255 doc/html/Makefile \
256 doc/html/images/Makefile \
257 doc/html/ru/Makefile \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000258 man/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000259 test/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000260 build/Makefile \
261 obj/bin/Makefile \
262 obj/lib/Makefile \
263 obj/Makefile \
264 flac.pbproj/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000265)