blob: 08aa04e110970e5621fed2c9afe82e1bf37fa2ba [file] [log] [blame]
Josh Coalson6b05bc52001-06-08 00:13:21 +00001# FLAC - Free Lossless Audio Codec
Josh Coalsona78fac62005-01-25 04:17:55 +00002# Copyright (C) 2001,2002,2003,2004,2005 Josh Coalson
Josh Coalson6b05bc52001-06-08 00:13:21 +00003#
Josh Coalsone8a76012003-02-07 00:14:32 +00004# This file is part the FLAC project. FLAC is comprised of several
5# components distributed under difference licenses. The codec libraries
6# are distributed under Xiph.Org's BSD-like license (see the file
7# COPYING.Xiph in this distribution). All other programs, libraries, and
8# plugins are distributed under the GPL (see COPYING.GPL). The documentation
9# is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
10# FLAC distribution contains at the top the terms under which it may be
11# distributed.
Josh Coalson6b05bc52001-06-08 00:13:21 +000012#
Josh Coalsone8a76012003-02-07 00:14:32 +000013# Since this particular file is relevant to all components of FLAC,
14# it may be distributed under the Xiph.Org license, which is the least
15# restrictive of those mentioned above. See the file COPYING.Xiph in this
16# distribution.
Josh Coalson6b05bc52001-06-08 00:13:21 +000017
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 Coalsonc28ec322004-09-10 00:20:04 +000022AM_INIT_AUTOMAKE(flac, 1.1.1)
Josh Coalson9f429ba2001-01-19 22:39:39 +000023
Matt Zimmerman057b5322002-10-05 14:41:19 +000024# Don't automagically regenerate autoconf/automake generated files unless
25# explicitly requested. Eases autobuilding -mdz
26AM_MAINTAINER_MODE
27
Josh Coalson9f429ba2001-01-19 22:39:39 +000028# We need two libtools, one that builds both shared and static, and
29# one that builds only static. This is because the resulting libtool
30# does not allow us to choose which to build at runtime.
31AM_PROG_LIBTOOL
32sed -e 's/^build_old_libs=yes/build_old_libs=no/' libtool > libtool-disable-static
33chmod +x libtool-disable-static
34
Josh Coalson985dd8d2004-07-29 05:25:36 +000035AM_PROG_AS
Josh Coalson57ba6f42002-06-07 05:27:37 +000036AC_PROG_CXX
Josh Coalson9f429ba2001-01-19 22:39:39 +000037AC_PROG_MAKE_SET
38
Josh Coalson5a804ca2002-05-17 06:08:13 +000039dnl check for getopt in standard library
40dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
41AC_CHECK_FUNCS(getopt_long, [], [])
42
Josh Coalsondef8eb82001-05-23 22:08:27 +000043AC_CANONICAL_HOST
Josh Coalson5a804ca2002-05-17 06:08:13 +000044case "$host_cpu" in
Josh Coalson0e3576e2001-05-25 00:07:51 +000045 i*86) cpu_ia32=true ; AC_DEFINE(FLAC__CPU_IA32) ;;
46 powerpc) cpu_ppc=true ; AC_DEFINE(FLAC__CPU_PPC) ;;
47 sparc) cpu_sparc=true ; AC_DEFINE(FLAC__CPU_SPARC) ;;
Josh Coalsoncf030c82001-05-23 20:59:48 +000048esac
49AM_CONDITIONAL(FLaC__CPU_IA32, test x$cpu_ia32 = xtrue)
50AM_CONDITIONAL(FLaC__CPU_PPC, test x$cpu_ppc = xtrue)
51AM_CONDITIONAL(FLaC__CPU_SPARC, test x$cpu_sparc = xtrue)
Josh Coalsonda0adb22001-06-18 23:07:19 +000052case "$host" in
Josh Coalsonfd218cf2005-01-21 01:51:09 +000053 *-pc-linux-gnu) sys_linux=true ; AC_DEFINE(FLAC__SYS_LINUX) ;;
54 *-*-darwin*) sys_darwin=true ; AC_DEFINE(FLAC__SYS_DARWIN) ;;
Josh Coalsonc0852172003-04-27 08:32:41 +000055 i386-*-openbsd3.[[0-3]]) OBJ_FORMAT=aoutb ;;
Josh Coalsonda0adb22001-06-18 23:07:19 +000056 *) OBJ_FORMAT=elf ;;
57esac
Josh Coalsonfd218cf2005-01-21 01:51:09 +000058AM_CONDITIONAL(FLaC__SYS_DARWIN, test x$sys_darwin = xtrue)
59AM_CONDITIONAL(FLaC__SYS_LINUX, test x$sys_linux = xtrue)
Josh Coalsonda0adb22001-06-18 23:07:19 +000060AC_SUBST(OBJ_FORMAT)
Josh Coalsoncf030c82001-05-23 20:59:48 +000061
Josh Coalson0e3576e2001-05-25 00:07:51 +000062if test x$cpu_ia32 = xtrue ; then
63AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
64fi
Josh Coalsoncf030c82001-05-23 20:59:48 +000065
66AC_ARG_ENABLE(asm-optimizations, [ --disable-asm-optimizations Don't use any assembly optimization routines], asm_opt=no, asm_opt=yes)
67AM_CONDITIONAL(FLaC__NO_ASM, test x$asm_opt = xno)
Josh Coalson0e3576e2001-05-25 00:07:51 +000068if test x$asm_opt = xno ; then
69AC_DEFINE(FLAC__NO_ASM)
70fi
Josh Coalsoncf030c82001-05-23 20:59:48 +000071
Josh Coalson9f429ba2001-01-19 22:39:39 +000072AC_ARG_ENABLE(debug,
Josh Coalsonda0adb22001-06-18 23:07:19 +000073[ --enable-debug Turn on debugging],
74[case "${enableval}" in
75 yes) debug=true ;;
76 no) debug=false ;;
77 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
78esac],[debug=false])
Josh Coalson9f429ba2001-01-19 22:39:39 +000079AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
80
Josh Coalsonbb14ae82001-12-04 06:46:35 +000081AC_ARG_ENABLE(sse,
82[ --enable-sse Enable SSE support by asserting that the OS supports SSE instructions],
Josh Coalsond01b13a2001-07-18 00:27:06 +000083[case "${enableval}" in
84 yes) sse_os=true ;;
85 no) sse_os=false ;;
Josh Coalsonbb14ae82001-12-04 06:46:35 +000086 *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
Josh Coalsond01b13a2001-07-18 00:27:06 +000087esac],[sse_os=false])
88AM_CONDITIONAL(FLaC__SSE_OS, test x$sse_os = xtrue)
89if test x$sse_os = xtrue ; then
90AC_DEFINE(FLAC__SSE_OS)
91fi
92
Josh Coalson28311cf2002-12-26 19:35:19 +000093AC_ARG_ENABLE(3dnow,
94[ --disable-3dnow Disable 3DNOW! optimizations],
95[case "${enableval}" in
96 yes) use_3dnow=true ;;
97 no) use_3dnow=false ;;
98 *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
99esac],[use_3dnow=true])
100AM_CONDITIONAL(FLaC__USE_3DNOW, test x$use_3dnow = xtrue)
101if test x$use_3dnow = xtrue ; then
Josh Coalsonc69f8782001-11-13 23:08:22 +0000102AC_DEFINE(FLAC__USE_3DNOW)
103fi
104
Josh Coalson3aadd102004-07-27 01:13:16 +0000105AC_ARG_ENABLE(altivec,
106[ --disable-altivec Disable Altivec optimizations],
107[case "${enableval}" in
108 yes) use_altivec=true ;;
109 no) use_altivec=false ;;
110 *) AC_MSG_ERROR(bad value ${enableval} for --enable-altivec) ;;
111esac],[use_altivec=true])
112AM_CONDITIONAL(FLaC__USE_ALTIVEC, test x$use_altivec = xtrue)
113if test x$use_altivec = xtrue ; then
114AC_DEFINE(FLAC__USE_ALTIVEC)
115fi
116
Josh Coalson3d730722003-01-14 06:59:50 +0000117AC_ARG_ENABLE(local-xmms-plugin,
118[ --enable-local-xmms-plugin Install XMMS plugin to ~/.xmms/Plugins instead of system location],
119[case "${enableval}" in
120 yes) install_xmms_plugin_locally=true ;;
121 no) install_xmms_plugin_locally=false ;;
122 *) AC_MSG_ERROR(bad value ${enableval} for --enable-local-xmms-plugin) ;;
123esac],[install_xmms_plugin_locally=false])
124AM_CONDITIONAL(FLaC__INSTALL_XMMS_PLUGIN_LOCALLY, test x$install_xmms_plugin_locally = xtrue)
125
Josh Coalson9b145182002-08-30 05:39:36 +0000126AC_ARG_ENABLE(exhaustive-tests,
Josh Coalsonb7767932002-09-17 05:36:39 +0000127[ --enable-exhaustive-tests Enable exhaustive testing],
Josh Coalson9b145182002-08-30 05:39:36 +0000128[case "${enableval}" in
129 yes) exhaustive_tests=true ;;
130 no) exhaustive_tests=false ;;
131 *) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
132esac],[exhaustive_tests=false])
133AM_CONDITIONAL(FLaC__EXHAUSTIVE_TESTS, test x$exhaustive_tests = xtrue)
Josh Coalson962bb3b2002-12-28 07:08:31 +0000134if test x$exhaustive_tests = xtrue ; then
135AC_DEFINE(FLAC__EXHAUSTIVE_TESTS)
136fi
Josh Coalsond1923622002-12-05 06:36:12 +0000137
138AC_ARG_ENABLE(valgrind-testing,
139[ --enable-valgrind-testing Run all tests inside Valgrind],
140[case "${enableval}" in
141 yes) valgrind_testing=true ;;
142 no) valgrind_testing=false ;;
143 *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind-testing) ;;
144esac],[valgrind_testing=false])
145AM_CONDITIONAL(FLaC__VALGRIND_TESTING, test x$valgrind_testing = xtrue)
Josh Coalson962bb3b2002-12-28 07:08:31 +0000146if test x$valgrind_testing = xtrue ; then
147AC_DEFINE(FLAC__VALGRIND_TESTING)
148fi
Josh Coalson9b145182002-08-30 05:39:36 +0000149
Josh Coalsone2fece22002-09-09 21:54:28 +0000150dnl check for ogg library
Josh Coalson3f6c9982002-09-05 05:40:58 +0000151XIPH_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 +0000152AM_CONDITIONAL(FLaC__HAS_OGG, [test x$have_ogg = xyes])
153if test x$have_ogg = xyes ; then
154AC_DEFINE(FLAC__HAS_OGG)
155fi
Josh Coalsonf7fc5c82001-10-31 18:31:36 +0000156
Josh Coalson9f429ba2001-01-19 22:39:39 +0000157AM_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 +0000158AM_CONDITIONAL(FLaC__HAS_XMMS, test x$XMMS_INPUT_PLUGIN_DIR != x)
159
Josh Coalson130cbb52002-07-16 16:12:27 +0000160dnl check for i18n(internationalization); these are from libiconv/gettext
Josh Coalson412fa3b2002-07-11 06:15:30 +0000161AM_ICONV
162AM_LANGINFO_CODESET
163
Josh Coalson20809742003-01-10 04:39:20 +0000164AC_CHECK_PROGS(DOXYGEN, doxygen)
165AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
166if test -n "$DOXYGEN" ; then
167AC_DEFINE(FLAC__HAS_DOXYGEN)
168fi
169
Josh Coalson90e57162004-07-30 00:46:39 +0000170AC_CHECK_PROGS(DOCBOOK_TO_MAN, docbook-to-man docbook2man)
171AM_CONDITIONAL(FLaC__HAS_DOCBOOK_TO_MAN, test -n "$DOCBOOK_TO_MAN")
172if test -n "$DOCBOOK_TO_MAN" ; then
173AC_DEFINE(FLAC__HAS_DOCBOOK_TO_MAN)
174fi
175
Josh Coalsonb9900222004-12-30 01:13:03 +0000176# only matters for x86
Josh Coalsoncf030c82001-05-23 20:59:48 +0000177AC_CHECK_PROGS(NASM, nasm)
178AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
Josh Coalson0e3576e2001-05-25 00:07:51 +0000179if test -n "$NASM" ; then
180AC_DEFINE(FLAC__HAS_NASM)
181fi
Josh Coalson9f429ba2001-01-19 22:39:39 +0000182
Josh Coalsonb9900222004-12-30 01:13:03 +0000183# only matters for PowerPC
184AC_CHECK_PROGS(AS, as)
185AC_CHECK_PROGS(GAS, gas)
186AM_CONDITIONAL(FLaC__HAS_AS, test -n "$AS")
187AM_CONDITIONAL(FLaC__HAS_GAS, test -n "$GAS")
188if test -n "$AS" ; then
189AC_DEFINE(FLAC__HAS_AS)
190fi
191if test -n "$GAS" ; then
192# funniest. macro. ever.
193AC_DEFINE(FLAC__HAS_GAS)
194fi
195
Josh Coalson57ba6f42002-06-07 05:27:37 +0000196OUR_CFLAGS_HEAD='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'
Josh Coalson9f429ba2001-01-19 22:39:39 +0000197if test x$debug = xtrue; then
Josh Coalson20809742003-01-10 04:39:20 +0000198 OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -g -O0 -DDEBUG"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000199else
Josh Coalson1e704552003-05-19 23:59:49 +0000200 OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -O2 -DNDEBUG"
Josh Coalsonda0adb22001-06-18 23:07:19 +0000201 if test x$GCC = xyes; then
Josh Coalson1e704552003-05-19 23:59:49 +0000202 OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -O3 -fomit-frame-pointer -funroll-loops -finline-functions -Wall -W -Winline -DFLaC__INLINE=__inline__"
Josh Coalsonda0adb22001-06-18 23:07:19 +0000203 fi
Josh Coalson9f429ba2001-01-19 22:39:39 +0000204fi
Josh Coalson20809742003-01-10 04:39:20 +0000205CFLAGS="$OUR_CFLAGS_HEAD $CFLAGS"
206CXXFLAGS="$OUR_CFLAGS_HEAD $CXXFLAGS"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000207
Matt Zimmermane5259172002-10-10 16:51:06 +0000208AM_CONFIG_HEADER(config.h)
Josh Coalsonf0a8c4f2003-01-15 03:17:51 +0000209AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA, [define to align allocated memory on 32-byte boundaries])
Matt Zimmermane5259172002-10-10 16:51:06 +0000210AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
211AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC])
212AH_TEMPLATE(FLAC__CPU_SPARC, [define if building for SPARC])
Josh Coalsonfd218cf2005-01-21 01:51:09 +0000213AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X])
214AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux])
Josh Coalson32386732003-01-02 07:29:58 +0000215AH_TEMPLATE(FLAC__EXHAUSTIVE_TESTS, [define to run even more tests])
216AH_TEMPLATE(FLAC__VALGRIND_TESTING, [define to enable use of Valgrind in testers])
Josh Coalson20809742003-01-10 04:39:20 +0000217AH_TEMPLATE(FLAC__HAS_DOXYGEN, [define if you have Doxygen])
Josh Coalson90e57162004-07-30 00:46:39 +0000218AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN, [define if you have docbook-to-man or docbook2man])
Josh Coalsonb9900222004-12-30 01:13:03 +0000219AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler])
220AH_TEMPLATE(FLAC__HAS_AS, [define if you are compiling for PowerPC and have the 'as' assembler])
221AH_TEMPLATE(FLAC__HAS_GAS, [define if you are compiling for PowerPC and have the 'gas' assembler])
Matt Zimmermane5259172002-10-10 16:51:06 +0000222AH_TEMPLATE(FLAC__HAS_OGG, [define if you have the ogg library])
223AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code])
Josh Coalson20809742003-01-10 04:39:20 +0000224AH_TEMPLATE(FLAC__SSE_OS, [define if your operating system supports SSE instructions])
Matt Zimmermane5259172002-10-10 16:51:06 +0000225AH_TEMPLATE(FLAC__USE_3DNOW, [define to enable use of 3Dnow! instructions])
Josh Coalson3aadd102004-07-27 01:13:16 +0000226AH_TEMPLATE(FLAC__USE_ALTIVEC, [define to enable use of Altivec instructions])
Matt Zimmermane5259172002-10-10 16:51:06 +0000227
uid38180b4bc14b2002-09-09 20:53:08 +0000228AC_OUTPUT( \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000229 Makefile \
230 src/Makefile \
231 src/libFLAC/Makefile \
232 src/libFLAC/ia32/Makefile \
Josh Coalson3aadd102004-07-27 01:13:16 +0000233 src/libFLAC/ppc/Makefile \
Josh Coalsonb9900222004-12-30 01:13:03 +0000234 src/libFLAC/ppc/as/Makefile \
235 src/libFLAC/ppc/gas/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000236 src/libFLAC/include/Makefile \
237 src/libFLAC/include/private/Makefile \
238 src/libFLAC/include/protected/Makefile \
239 src/libFLAC++/Makefile \
Josh Coalsonc49380d2002-08-07 17:38:08 +0000240 src/libOggFLAC/Makefile \
241 src/libOggFLAC/include/Makefile \
Josh Coalsonce3dd362003-12-17 05:26:34 +0000242 src/libOggFLAC/include/private/Makefile \
Josh Coalsonc49380d2002-08-07 17:38:08 +0000243 src/libOggFLAC/include/protected/Makefile \
244 src/libOggFLAC++/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000245 src/flac/Makefile \
246 src/metaflac/Makefile \
Josh Coalson20809742003-01-10 04:39:20 +0000247 src/monkeys_audio_utilities/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000248 src/monkeys_audio_utilities/flac_mac/Makefile \
249 src/monkeys_audio_utilities/flac_ren/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000250 src/plugin_common/Makefile \
251 src/plugin_winamp2/Makefile \
Josh Coalson20809742003-01-10 04:39:20 +0000252 src/plugin_winamp2/include/Makefile \
253 src/plugin_winamp2/include/winamp2/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000254 src/plugin_xmms/Makefile \
255 src/share/Makefile \
Josh Coalson3c043fd2002-10-25 04:57:05 +0000256 src/share/getopt/Makefile \
Josh Coalsonb8f8a072002-11-07 05:07:30 +0000257 src/share/grabbag/Makefile \
Josh Coalson9c650a52003-12-17 04:51:06 +0000258 src/share/replaygain_analysis/Makefile \
259 src/share/replaygain_synthesis/Makefile \
Josh Coalsone2999b72003-12-17 04:54:20 +0000260 src/share/replaygain_synthesis/include/Makefile \
261 src/share/replaygain_synthesis/include/private/Makefile \
Josh Coalson3c043fd2002-10-25 04:57:05 +0000262 src/share/utf8/Makefile \
Josh Coalson1dca1c22002-12-03 06:30:14 +0000263 src/test_grabbag/Makefile \
Josh Coalson20809742003-01-10 04:39:20 +0000264 src/test_grabbag/cuesheet/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000265 src/test_libFLAC/Makefile \
266 src/test_libFLAC++/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000267 src/test_libOggFLAC/Makefile \
268 src/test_libOggFLAC++/Makefile \
Josh Coalson94b54992004-09-21 05:41:23 +0000269 src/test_seeking/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000270 src/test_streams/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000271 include/Makefile \
272 include/FLAC/Makefile \
Josh Coalson5a804ca2002-05-17 06:08:13 +0000273 include/FLAC++/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000274 include/OggFLAC/Makefile \
275 include/OggFLAC++/Makefile \
Josh Coalson5a804ca2002-05-17 06:08:13 +0000276 include/share/Makefile \
Josh Coalsonb8f8a072002-11-07 05:07:30 +0000277 include/share/grabbag/Makefile \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000278 doc/Makefile \
Josh Coalson130cbb52002-07-16 16:12:27 +0000279 doc/html/Makefile \
280 doc/html/images/Makefile \
281 doc/html/ru/Makefile \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000282 man/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000283 test/Makefile \
Josh Coalson20809742003-01-10 04:39:20 +0000284 test/cuesheets/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000285 build/Makefile \
Josh Coalson20809742003-01-10 04:39:20 +0000286 obj/Makefile \
287 obj/debug/Makefile \
Josh Coalsonb74fc982002-11-20 06:40:08 +0000288 obj/debug/bin/Makefile \
289 obj/debug/lib/Makefile \
Josh Coalson20809742003-01-10 04:39:20 +0000290 obj/release/Makefile \
Josh Coalsonb74fc982002-11-20 06:40:08 +0000291 obj/release/bin/Makefile \
292 obj/release/lib/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000293 flac.pbproj/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000294)