blob: 912b44e1a09675e91e4aa565d77442419a9d250f [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 Coalson27ae3482005-01-27 03:59:55 +000039AC_CHECK_TYPES(socklen_t, [], [])
40
Josh Coalson5a804ca2002-05-17 06:08:13 +000041dnl check for getopt in standard library
42dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
43AC_CHECK_FUNCS(getopt_long, [], [])
44
Josh Coalsondef8eb82001-05-23 22:08:27 +000045AC_CANONICAL_HOST
Josh Coalson5a804ca2002-05-17 06:08:13 +000046case "$host_cpu" in
Josh Coalson0e3576e2001-05-25 00:07:51 +000047 i*86) cpu_ia32=true ; AC_DEFINE(FLAC__CPU_IA32) ;;
48 powerpc) cpu_ppc=true ; AC_DEFINE(FLAC__CPU_PPC) ;;
49 sparc) cpu_sparc=true ; AC_DEFINE(FLAC__CPU_SPARC) ;;
Josh Coalsoncf030c82001-05-23 20:59:48 +000050esac
51AM_CONDITIONAL(FLaC__CPU_IA32, test x$cpu_ia32 = xtrue)
52AM_CONDITIONAL(FLaC__CPU_PPC, test x$cpu_ppc = xtrue)
53AM_CONDITIONAL(FLaC__CPU_SPARC, test x$cpu_sparc = xtrue)
Josh Coalsonda0adb22001-06-18 23:07:19 +000054case "$host" in
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 Coalson27ae3482005-01-27 03:59:55 +000058AC_SUBST(OBJ_FORMAT)
59case "$host" in
60 *-pc-linux-gnu) sys_linux=true ; AC_DEFINE(FLAC__SYS_LINUX) ;;
61 *-*-darwin*) sys_darwin=true ; AC_DEFINE(FLAC__SYS_DARWIN) ;;
62esac
Josh Coalsonfd218cf2005-01-21 01:51:09 +000063AM_CONDITIONAL(FLaC__SYS_DARWIN, test x$sys_darwin = xtrue)
64AM_CONDITIONAL(FLaC__SYS_LINUX, test x$sys_linux = xtrue)
Josh Coalsoncf030c82001-05-23 20:59:48 +000065
Josh Coalson0e3576e2001-05-25 00:07:51 +000066if test x$cpu_ia32 = xtrue ; then
67AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
68fi
Josh Coalsoncf030c82001-05-23 20:59:48 +000069
70AC_ARG_ENABLE(asm-optimizations, [ --disable-asm-optimizations Don't use any assembly optimization routines], asm_opt=no, asm_opt=yes)
71AM_CONDITIONAL(FLaC__NO_ASM, test x$asm_opt = xno)
Josh Coalson0e3576e2001-05-25 00:07:51 +000072if test x$asm_opt = xno ; then
73AC_DEFINE(FLAC__NO_ASM)
74fi
Josh Coalsoncf030c82001-05-23 20:59:48 +000075
Josh Coalson9f429ba2001-01-19 22:39:39 +000076AC_ARG_ENABLE(debug,
Josh Coalsonda0adb22001-06-18 23:07:19 +000077[ --enable-debug Turn on debugging],
78[case "${enableval}" in
79 yes) debug=true ;;
80 no) debug=false ;;
81 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
82esac],[debug=false])
Josh Coalson9f429ba2001-01-19 22:39:39 +000083AM_CONDITIONAL(DEBUG, test x$debug = xtrue)
84
Josh Coalsonbb14ae82001-12-04 06:46:35 +000085AC_ARG_ENABLE(sse,
86[ --enable-sse Enable SSE support by asserting that the OS supports SSE instructions],
Josh Coalsond01b13a2001-07-18 00:27:06 +000087[case "${enableval}" in
88 yes) sse_os=true ;;
89 no) sse_os=false ;;
Josh Coalsonbb14ae82001-12-04 06:46:35 +000090 *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
Josh Coalsond01b13a2001-07-18 00:27:06 +000091esac],[sse_os=false])
92AM_CONDITIONAL(FLaC__SSE_OS, test x$sse_os = xtrue)
93if test x$sse_os = xtrue ; then
94AC_DEFINE(FLAC__SSE_OS)
95fi
96
Josh Coalson28311cf2002-12-26 19:35:19 +000097AC_ARG_ENABLE(3dnow,
98[ --disable-3dnow Disable 3DNOW! optimizations],
99[case "${enableval}" in
100 yes) use_3dnow=true ;;
101 no) use_3dnow=false ;;
102 *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
103esac],[use_3dnow=true])
104AM_CONDITIONAL(FLaC__USE_3DNOW, test x$use_3dnow = xtrue)
105if test x$use_3dnow = xtrue ; then
Josh Coalsonc69f8782001-11-13 23:08:22 +0000106AC_DEFINE(FLAC__USE_3DNOW)
107fi
108
Josh Coalson3aadd102004-07-27 01:13:16 +0000109AC_ARG_ENABLE(altivec,
110[ --disable-altivec Disable Altivec optimizations],
111[case "${enableval}" in
112 yes) use_altivec=true ;;
113 no) use_altivec=false ;;
114 *) AC_MSG_ERROR(bad value ${enableval} for --enable-altivec) ;;
115esac],[use_altivec=true])
116AM_CONDITIONAL(FLaC__USE_ALTIVEC, test x$use_altivec = xtrue)
117if test x$use_altivec = xtrue ; then
118AC_DEFINE(FLAC__USE_ALTIVEC)
119fi
120
Josh Coalson3d730722003-01-14 06:59:50 +0000121AC_ARG_ENABLE(local-xmms-plugin,
122[ --enable-local-xmms-plugin Install XMMS plugin to ~/.xmms/Plugins instead of system location],
123[case "${enableval}" in
124 yes) install_xmms_plugin_locally=true ;;
125 no) install_xmms_plugin_locally=false ;;
126 *) AC_MSG_ERROR(bad value ${enableval} for --enable-local-xmms-plugin) ;;
127esac],[install_xmms_plugin_locally=false])
128AM_CONDITIONAL(FLaC__INSTALL_XMMS_PLUGIN_LOCALLY, test x$install_xmms_plugin_locally = xtrue)
129
Josh Coalson9b145182002-08-30 05:39:36 +0000130AC_ARG_ENABLE(exhaustive-tests,
Josh Coalsonb7767932002-09-17 05:36:39 +0000131[ --enable-exhaustive-tests Enable exhaustive testing],
Josh Coalson9b145182002-08-30 05:39:36 +0000132[case "${enableval}" in
133 yes) exhaustive_tests=true ;;
134 no) exhaustive_tests=false ;;
135 *) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
136esac],[exhaustive_tests=false])
137AM_CONDITIONAL(FLaC__EXHAUSTIVE_TESTS, test x$exhaustive_tests = xtrue)
Josh Coalson962bb3b2002-12-28 07:08:31 +0000138if test x$exhaustive_tests = xtrue ; then
139AC_DEFINE(FLAC__EXHAUSTIVE_TESTS)
140fi
Josh Coalsond1923622002-12-05 06:36:12 +0000141
142AC_ARG_ENABLE(valgrind-testing,
143[ --enable-valgrind-testing Run all tests inside Valgrind],
144[case "${enableval}" in
145 yes) valgrind_testing=true ;;
146 no) valgrind_testing=false ;;
147 *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind-testing) ;;
148esac],[valgrind_testing=false])
149AM_CONDITIONAL(FLaC__VALGRIND_TESTING, test x$valgrind_testing = xtrue)
Josh Coalson962bb3b2002-12-28 07:08:31 +0000150if test x$valgrind_testing = xtrue ; then
151AC_DEFINE(FLAC__VALGRIND_TESTING)
152fi
Josh Coalson9b145182002-08-30 05:39:36 +0000153
Josh Coalsone2fece22002-09-09 21:54:28 +0000154dnl check for ogg library
Josh Coalson3f6c9982002-09-05 05:40:58 +0000155XIPH_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 +0000156AM_CONDITIONAL(FLaC__HAS_OGG, [test x$have_ogg = xyes])
157if test x$have_ogg = xyes ; then
158AC_DEFINE(FLAC__HAS_OGG)
159fi
Josh Coalsonf7fc5c82001-10-31 18:31:36 +0000160
Josh Coalson9f429ba2001-01-19 22:39:39 +0000161AM_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 +0000162AM_CONDITIONAL(FLaC__HAS_XMMS, test x$XMMS_INPUT_PLUGIN_DIR != x)
163
Josh Coalson130cbb52002-07-16 16:12:27 +0000164dnl check for i18n(internationalization); these are from libiconv/gettext
Josh Coalson412fa3b2002-07-11 06:15:30 +0000165AM_ICONV
166AM_LANGINFO_CODESET
167
Josh Coalson20809742003-01-10 04:39:20 +0000168AC_CHECK_PROGS(DOXYGEN, doxygen)
169AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
170if test -n "$DOXYGEN" ; then
171AC_DEFINE(FLAC__HAS_DOXYGEN)
172fi
173
Josh Coalson90e57162004-07-30 00:46:39 +0000174AC_CHECK_PROGS(DOCBOOK_TO_MAN, docbook-to-man docbook2man)
175AM_CONDITIONAL(FLaC__HAS_DOCBOOK_TO_MAN, test -n "$DOCBOOK_TO_MAN")
176if test -n "$DOCBOOK_TO_MAN" ; then
177AC_DEFINE(FLAC__HAS_DOCBOOK_TO_MAN)
178fi
179
Josh Coalsonb9900222004-12-30 01:13:03 +0000180# only matters for x86
Josh Coalsoncf030c82001-05-23 20:59:48 +0000181AC_CHECK_PROGS(NASM, nasm)
182AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
Josh Coalson0e3576e2001-05-25 00:07:51 +0000183if test -n "$NASM" ; then
184AC_DEFINE(FLAC__HAS_NASM)
185fi
Josh Coalson9f429ba2001-01-19 22:39:39 +0000186
Josh Coalsonb9900222004-12-30 01:13:03 +0000187# only matters for PowerPC
188AC_CHECK_PROGS(AS, as)
189AC_CHECK_PROGS(GAS, gas)
190AM_CONDITIONAL(FLaC__HAS_AS, test -n "$AS")
191AM_CONDITIONAL(FLaC__HAS_GAS, test -n "$GAS")
192if test -n "$AS" ; then
193AC_DEFINE(FLAC__HAS_AS)
194fi
195if test -n "$GAS" ; then
196# funniest. macro. ever.
197AC_DEFINE(FLAC__HAS_GAS)
198fi
199
Josh Coalson57ba6f42002-06-07 05:27:37 +0000200OUR_CFLAGS_HEAD='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'
Josh Coalson9f429ba2001-01-19 22:39:39 +0000201if test x$debug = xtrue; then
Josh Coalson20809742003-01-10 04:39:20 +0000202 OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -g -O0 -DDEBUG"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000203else
Josh Coalson1e704552003-05-19 23:59:49 +0000204 OUR_CFLAGS_HEAD="$OUR_CFLAGS_HEAD -O2 -DNDEBUG"
Josh Coalsonda0adb22001-06-18 23:07:19 +0000205 if test x$GCC = xyes; then
Josh Coalson1e704552003-05-19 23:59:49 +0000206 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 +0000207 fi
Josh Coalson9f429ba2001-01-19 22:39:39 +0000208fi
Josh Coalson20809742003-01-10 04:39:20 +0000209CFLAGS="$OUR_CFLAGS_HEAD $CFLAGS"
210CXXFLAGS="$OUR_CFLAGS_HEAD $CXXFLAGS"
Josh Coalson9f429ba2001-01-19 22:39:39 +0000211
Matt Zimmermane5259172002-10-10 16:51:06 +0000212AM_CONFIG_HEADER(config.h)
Josh Coalsonf0a8c4f2003-01-15 03:17:51 +0000213AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA, [define to align allocated memory on 32-byte boundaries])
Matt Zimmermane5259172002-10-10 16:51:06 +0000214AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
215AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC])
216AH_TEMPLATE(FLAC__CPU_SPARC, [define if building for SPARC])
Josh Coalsonfd218cf2005-01-21 01:51:09 +0000217AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X])
218AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux])
Josh Coalson32386732003-01-02 07:29:58 +0000219AH_TEMPLATE(FLAC__EXHAUSTIVE_TESTS, [define to run even more tests])
220AH_TEMPLATE(FLAC__VALGRIND_TESTING, [define to enable use of Valgrind in testers])
Josh Coalson20809742003-01-10 04:39:20 +0000221AH_TEMPLATE(FLAC__HAS_DOXYGEN, [define if you have Doxygen])
Josh Coalson90e57162004-07-30 00:46:39 +0000222AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN, [define if you have docbook-to-man or docbook2man])
Josh Coalsonb9900222004-12-30 01:13:03 +0000223AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler])
224AH_TEMPLATE(FLAC__HAS_AS, [define if you are compiling for PowerPC and have the 'as' assembler])
225AH_TEMPLATE(FLAC__HAS_GAS, [define if you are compiling for PowerPC and have the 'gas' assembler])
Matt Zimmermane5259172002-10-10 16:51:06 +0000226AH_TEMPLATE(FLAC__HAS_OGG, [define if you have the ogg library])
227AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code])
Josh Coalson20809742003-01-10 04:39:20 +0000228AH_TEMPLATE(FLAC__SSE_OS, [define if your operating system supports SSE instructions])
Matt Zimmermane5259172002-10-10 16:51:06 +0000229AH_TEMPLATE(FLAC__USE_3DNOW, [define to enable use of 3Dnow! instructions])
Josh Coalson3aadd102004-07-27 01:13:16 +0000230AH_TEMPLATE(FLAC__USE_ALTIVEC, [define to enable use of Altivec instructions])
Matt Zimmermane5259172002-10-10 16:51:06 +0000231
uid38180b4bc14b2002-09-09 20:53:08 +0000232AC_OUTPUT( \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000233 Makefile \
234 src/Makefile \
235 src/libFLAC/Makefile \
236 src/libFLAC/ia32/Makefile \
Josh Coalson3aadd102004-07-27 01:13:16 +0000237 src/libFLAC/ppc/Makefile \
Josh Coalsonb9900222004-12-30 01:13:03 +0000238 src/libFLAC/ppc/as/Makefile \
239 src/libFLAC/ppc/gas/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000240 src/libFLAC/include/Makefile \
241 src/libFLAC/include/private/Makefile \
242 src/libFLAC/include/protected/Makefile \
243 src/libFLAC++/Makefile \
Josh Coalsonc49380d2002-08-07 17:38:08 +0000244 src/libOggFLAC/Makefile \
245 src/libOggFLAC/include/Makefile \
Josh Coalsonce3dd362003-12-17 05:26:34 +0000246 src/libOggFLAC/include/private/Makefile \
Josh Coalsonc49380d2002-08-07 17:38:08 +0000247 src/libOggFLAC/include/protected/Makefile \
248 src/libOggFLAC++/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000249 src/flac/Makefile \
250 src/metaflac/Makefile \
Josh Coalson20809742003-01-10 04:39:20 +0000251 src/monkeys_audio_utilities/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000252 src/monkeys_audio_utilities/flac_mac/Makefile \
253 src/monkeys_audio_utilities/flac_ren/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000254 src/plugin_common/Makefile \
255 src/plugin_winamp2/Makefile \
Josh Coalson20809742003-01-10 04:39:20 +0000256 src/plugin_winamp2/include/Makefile \
257 src/plugin_winamp2/include/winamp2/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000258 src/plugin_xmms/Makefile \
259 src/share/Makefile \
Josh Coalson3c043fd2002-10-25 04:57:05 +0000260 src/share/getopt/Makefile \
Josh Coalsonb8f8a072002-11-07 05:07:30 +0000261 src/share/grabbag/Makefile \
Josh Coalson9c650a52003-12-17 04:51:06 +0000262 src/share/replaygain_analysis/Makefile \
263 src/share/replaygain_synthesis/Makefile \
Josh Coalsone2999b72003-12-17 04:54:20 +0000264 src/share/replaygain_synthesis/include/Makefile \
265 src/share/replaygain_synthesis/include/private/Makefile \
Josh Coalson3c043fd2002-10-25 04:57:05 +0000266 src/share/utf8/Makefile \
Josh Coalson1dca1c22002-12-03 06:30:14 +0000267 src/test_grabbag/Makefile \
Josh Coalson20809742003-01-10 04:39:20 +0000268 src/test_grabbag/cuesheet/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000269 src/test_libFLAC/Makefile \
270 src/test_libFLAC++/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000271 src/test_libOggFLAC/Makefile \
272 src/test_libOggFLAC++/Makefile \
Josh Coalson94b54992004-09-21 05:41:23 +0000273 src/test_seeking/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000274 src/test_streams/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000275 include/Makefile \
276 include/FLAC/Makefile \
Josh Coalson5a804ca2002-05-17 06:08:13 +0000277 include/FLAC++/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000278 include/OggFLAC/Makefile \
279 include/OggFLAC++/Makefile \
Josh Coalson5a804ca2002-05-17 06:08:13 +0000280 include/share/Makefile \
Josh Coalsonb8f8a072002-11-07 05:07:30 +0000281 include/share/grabbag/Makefile \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000282 doc/Makefile \
Josh Coalson130cbb52002-07-16 16:12:27 +0000283 doc/html/Makefile \
284 doc/html/images/Makefile \
285 doc/html/ru/Makefile \
Josh Coalson4c8f73a2001-07-22 07:27:45 +0000286 man/Makefile \
Josh Coalson1d96b7e2002-07-24 06:13:33 +0000287 test/Makefile \
Josh Coalson20809742003-01-10 04:39:20 +0000288 test/cuesheets/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000289 build/Makefile \
Josh Coalson20809742003-01-10 04:39:20 +0000290 obj/Makefile \
291 obj/debug/Makefile \
Josh Coalsonb74fc982002-11-20 06:40:08 +0000292 obj/debug/bin/Makefile \
293 obj/debug/lib/Makefile \
Josh Coalson20809742003-01-10 04:39:20 +0000294 obj/release/Makefile \
Josh Coalsonb74fc982002-11-20 06:40:08 +0000295 obj/release/bin/Makefile \
296 obj/release/lib/Makefile \
Josh Coalson1f99eac2002-08-23 06:45:23 +0000297 flac.pbproj/Makefile \
Josh Coalsonda0adb22001-06-18 23:07:19 +0000298)