blob: 04277e132d637d466f571837db9b02f32c2664c5 [file] [log] [blame]
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +11001# FLAC - Free Lossless Audio Codec
2# Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson
3#
4# 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.
12#
13# 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.
17
18# NOTE that for many of the AM_CONDITIONALs we use the prefix FLaC__
19# instead of FLAC__ since autoconf triggers off 'AC_' in strings
20
21AC_INIT(src/flac/main.c)
22AM_INIT_AUTOMAKE(flac, 1.2.1)
Erik de Castro Lopo886b9602012-02-03 05:52:01 +110023m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110024
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110025# Enable the generation of shared libraries under Win32
26AC_LIBTOOL_WIN32_DLL
27
28# 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
35AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
36
37AM_PROG_AS
38AC_PROG_CXX
39AC_PROG_MAKE_SET
40
41AC_SYS_LARGEFILE
42AC_FUNC_FSEEKO
43
44AC_CHECK_SIZEOF(void*,0)
45
46#@@@ new name is AC_CONFIG_HEADERS
47AM_CONFIG_HEADER(config.h)
48
49AC_LANG_PUSH(C++)
50# c++ flavor first
51AC_C_VARARRAYS
52if test $ac_cv_c_vararrays = yes; then
53 AC_DEFINE([HAVE_CXX_VARARRAYS], 1, [Define to 1 if C++ supports variable-length arrays.])
54fi
55AC_LANG_POP(C++)
56# c flavor
57AC_HEADER_STDC
58
Erik de Castro Lopoa3f43aa2012-02-04 21:08:46 +110059AC_CHECK_HEADERS(stdint.h)
60AC_SUBST(HAVE_STDINT_H)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110061AC_CHECK_HEADERS(inttypes.h)
Erik de Castro Lopoa3f43aa2012-02-04 21:08:46 +110062AC_SUBST(HAVE_INTTYPES_H)
63AC_CHECK_HEADERS(byteswap.h)
64AC_SUBST(HAVE_BYTESWAP_H)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110065
66AC_C_VARARRAYS
67
68AC_C_BIGENDIAN
69AC_C_INLINE
70
71AC_CHECK_TYPES(socklen_t, [], [])
72
73dnl check for getopt in standard library
74dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
75AC_CHECK_FUNCS(getopt_long, [], [])
76
77case "$host_cpu" in
78 i*86)
79 cpu_ia32=true
80 AC_DEFINE(FLAC__CPU_IA32)
81 AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
82 ;;
83 powerpc)
84 cpu_ppc=true
85 AC_DEFINE(FLAC__CPU_PPC)
86 AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC])
87 ;;
88 sparc)
89 cpu_sparc=true
90 AC_DEFINE(FLAC__CPU_SPARC)
91 AH_TEMPLATE(FLAC__CPU_SPARC, [define if building for SPARC])
92 ;;
93esac
94AM_CONDITIONAL(FLaC__CPU_IA32, test "x$cpu_ia32" = xtrue)
95AM_CONDITIONAL(FLaC__CPU_PPC, test "x$cpu_ppc" = xtrue)
96AM_CONDITIONAL(FLaC__CPU_SPARC, test "x$cpu_sparc" = xtrue)
97
98case "$host" in
99 i386-*-openbsd3.[[0-3]]) OBJ_FORMAT=aoutb ;;
100 *-*-cygwin|*mingw*) OBJ_FORMAT=win32 ;;
101 *-*-darwin*) OBJ_FORMAT=macho ;;
Erik de Castro Lopo0fe97672012-02-05 16:29:43 +1100102 *emx*) OBJ_FORMAT=aout ;;
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100103 *) OBJ_FORMAT=elf ;;
104esac
105AC_SUBST(OBJ_FORMAT)
106
107case "$host" in
Erik de Castro Lopo8b4bc4b2012-02-05 16:28:40 +1100108 *-*-cygwin|*mingw*|*emx*)
109 # define this variable for enabling strict exports with libtool; for now, it's supported by Win32 and OS/2
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100110 LT_NO_UNDEFINED="-no-undefined"
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100111 ;;
112 *)
113 LT_NO_UNDEFINED=
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100114 ;;
115esac
116AC_SUBST(LT_NO_UNDEFINED)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100117
118case "$host" in
119 *-pc-linux-gnu)
120 sys_linux=true
121 AC_DEFINE(FLAC__SYS_LINUX)
122 AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux])
123 ;;
124 *-*-darwin*)
125 sys_darwin=true
126 AC_DEFINE(FLAC__SYS_DARWIN)
127 AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X])
128 ;;
129esac
130AM_CONDITIONAL(FLaC__SYS_DARWIN, test "x$sys_darwin" = xtrue)
131AM_CONDITIONAL(FLaC__SYS_LINUX, test "x$sys_linux" = xtrue)
132
133if test "x$cpu_ia32" = xtrue ; then
134AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
135AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA, [define to align allocated memory on 32-byte boundaries])
136fi
137
138AC_ARG_ENABLE(asm-optimizations, AC_HELP_STRING([--disable-asm-optimizations], [Don't use any assembly optimization routines]), asm_opt=no, asm_opt=yes)
139dnl ' Terminate the damn single quote
140AM_CONDITIONAL(FLaC__NO_ASM, test "x$asm_opt" = xno)
141if test "x$asm_opt" = xno ; then
142AC_DEFINE(FLAC__NO_ASM)
143AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code])
144fi
145
146AC_ARG_ENABLE(debug,
147AC_HELP_STRING([--enable-debug], [Turn on debugging]),
148[case "${enableval}" in
149 yes) debug=true ;;
150 no) debug=false ;;
151 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
152esac],[debug=false])
153AM_CONDITIONAL(DEBUG, test "x$debug" = xtrue)
154
155AC_ARG_ENABLE(sse,
156AC_HELP_STRING([--enable-sse], [Enable SSE support by asserting that the OS supports SSE instructions]),
157[case "${enableval}" in
158 yes) sse_os=true ;;
159 no) sse_os=false ;;
160 *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
161esac],[sse_os=false])
162AM_CONDITIONAL(FLaC__SSE_OS, test "x$sse_os" = xtrue)
163if test "x$sse_os" = xtrue ; then
164AC_DEFINE(FLAC__SSE_OS)
165AH_TEMPLATE(FLAC__SSE_OS, [define if your operating system supports SSE instructions])
166fi
167
168AC_ARG_ENABLE(3dnow,
169AC_HELP_STRING([--disable-3dnow], [Disable 3DNOW! optimizations]),
170[case "${enableval}" in
171 yes) use_3dnow=true ;;
172 no) use_3dnow=false ;;
173 *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
174esac],[use_3dnow=true])
175AM_CONDITIONAL(FLaC__USE_3DNOW, test "x$use_3dnow" = xtrue)
176if test "x$use_3dnow" = xtrue ; then
177AC_DEFINE(FLAC__USE_3DNOW)
178AH_TEMPLATE(FLAC__USE_3DNOW, [define to enable use of 3Dnow! instructions])
179fi
180
181AC_ARG_ENABLE(altivec,
182AC_HELP_STRING([--disable-altivec], [Disable Altivec optimizations]),
183[case "${enableval}" in
184 yes) use_altivec=true ;;
185 no) use_altivec=false ;;
186 *) AC_MSG_ERROR(bad value ${enableval} for --enable-altivec) ;;
187esac],[use_altivec=true])
188AM_CONDITIONAL(FLaC__USE_ALTIVEC, test "x$use_altivec" = xtrue)
189if test "x$use_altivec" = xtrue ; then
190AC_DEFINE(FLAC__USE_ALTIVEC)
191AH_TEMPLATE(FLAC__USE_ALTIVEC, [define to enable use of Altivec instructions])
192fi
193
194AC_ARG_ENABLE(thorough-tests,
195AC_HELP_STRING([--disable-thorough-tests], [Disable thorough (long) testing, do only basic tests]),
196[case "${enableval}" in
197 yes) thorough_tests=true ;;
198 no) thorough_tests=false ;;
199 *) AC_MSG_ERROR(bad value ${enableval} for --enable-thorough-tests) ;;
200esac],[thorough_tests=true])
201AC_ARG_ENABLE(exhaustive-tests,
202AC_HELP_STRING([--enable-exhaustive-tests], [Enable exhaustive testing (VERY long)]),
203[case "${enableval}" in
204 yes) exhaustive_tests=true ;;
205 no) exhaustive_tests=false ;;
206 *) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
207esac],[exhaustive_tests=false])
208if test "x$thorough_tests" = xfalse ; then
209FLAC__TEST_LEVEL=0
210elif test "x$exhaustive_tests" = xfalse ; then
211FLAC__TEST_LEVEL=1
212else
213FLAC__TEST_LEVEL=2
214fi
215AC_SUBST(FLAC__TEST_LEVEL)
216
217AC_ARG_ENABLE(gcc-werror,
218 AC_HELP_STRING([--enable-gcc-werror], [enable -Werror in all Makefiles]))
219
220AC_ARG_ENABLE(valgrind-testing,
221AC_HELP_STRING([--enable-valgrind-testing], [Run all tests inside Valgrind]),
222[case "${enableval}" in
223 yes) FLAC__TEST_WITH_VALGRIND=yes ;;
224 no) FLAC__TEST_WITH_VALGRIND=no ;;
225 *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind-testing) ;;
226esac],[FLAC__TEST_WITH_VALGRIND=no])
227AC_SUBST(FLAC__TEST_WITH_VALGRIND)
228
229AC_ARG_ENABLE(doxygen-docs,
230AC_HELP_STRING([--disable-doxygen-docs], [Disable API documentation building via Doxygen]),
231[case "${enableval}" in
232 yes) enable_doxygen_docs=true ;;
233 no) enable_doxygen_docs=false ;;
234 *) AC_MSG_ERROR(bad value ${enableval} for --enable-doxygen-docs) ;;
235esac],[enable_doxygen_docs=true])
236if test "x$enable_doxygen_docs" != xfalse ; then
237 AC_CHECK_PROGS(DOXYGEN, doxygen)
238fi
239AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
240
241AC_ARG_ENABLE(local-xmms-plugin,
242AC_HELP_STRING([--enable-local-xmms-plugin], [Install XMMS plugin to ~/.xmms/Plugins instead of system location]),
243[case "${enableval}" in
244 yes) install_xmms_plugin_locally=true ;;
245 no) install_xmms_plugin_locally=false ;;
246 *) AC_MSG_ERROR(bad value ${enableval} for --enable-local-xmms-plugin) ;;
247esac],[install_xmms_plugin_locally=false])
248AM_CONDITIONAL(FLaC__INSTALL_XMMS_PLUGIN_LOCALLY, test "x$install_xmms_plugin_locally" = xtrue)
249
250AC_ARG_ENABLE(xmms-plugin,
251AC_HELP_STRING([--disable-xmms-plugin], [Do not build XMMS plugin]),
252[case "${enableval}" in
253 yes) enable_xmms_plugin=true ;;
254 no) enable_xmms_plugin=false ;;
255 *) AC_MSG_ERROR(bad value ${enableval} for --enable-xmms-plugin) ;;
256esac],[enable_xmms_plugin=true])
257if test "x$enable_xmms_plugin" != xfalse ; then
258 AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - XMMS support will not be built]))
259fi
260AM_CONDITIONAL(FLaC__HAS_XMMS, test -n "$XMMS_INPUT_PLUGIN_DIR")
261
262dnl build FLAC++ or not
263AC_ARG_ENABLE([cpplibs],
264AC_HELP_STRING([--disable-cpplibs], [Do not build libFLAC++]),
265[case "${enableval}" in
266 yes) disable_cpplibs=false ;;
267 no) disable_cpplibs=true ;;
268 *) AC_MSG_ERROR(bad value ${enableval} for --enable-cpplibs) ;;
269esac], [disable_cpplibs=false])
270AM_CONDITIONAL(FLaC__WITH_CPPLIBS, [test "x$disable_cpplibs" != xtrue])
271
272dnl check for ogg library
273AC_ARG_ENABLE([ogg],
274 AC_HELP_STRING([--disable-ogg], [Disable ogg support (default: test for libogg)]),
275 [ want_ogg=$enableval ], [ want_ogg=yes ] )
276
277if test "x$want_ogg" != "xno"; then
278 XIPH_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development enviroment not installed - Ogg support will not be built]))
279fi
280
281AM_CONDITIONAL(FLaC__HAS_OGG, [test "x$have_ogg" = xyes])
282if test "x$have_ogg" = xyes ; then
283AC_DEFINE(FLAC__HAS_OGG)
284AH_TEMPLATE(FLAC__HAS_OGG, [define if you have the ogg library])
285fi
286
287dnl check for i18n(internationalization); these are from libiconv/gettext
288AM_ICONV
289AM_LANGINFO_CODESET
290
291AC_CHECK_PROGS(DOCBOOK_TO_MAN, docbook-to-man docbook2man)
292AM_CONDITIONAL(FLaC__HAS_DOCBOOK_TO_MAN, test -n "$DOCBOOK_TO_MAN")
293if test -n "$DOCBOOK_TO_MAN" ; then
294AC_DEFINE(FLAC__HAS_DOCBOOK_TO_MAN)
295AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN, [define if you have docbook-to-man or docbook2man])
296fi
297
298# only matters for x86
299AC_CHECK_PROGS(NASM, nasm)
300AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
301if test -n "$NASM" ; then
302AC_DEFINE(FLAC__HAS_NASM)
303AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler])
304fi
305
306# only matters for PowerPC
307AC_CHECK_PROGS(AS, as, as)
308AC_CHECK_PROGS(GAS, gas, gas)
309
310# try -v (apple as) and --version (gas) at the same time
311test "$AS" = "as" && as --version -v < /dev/null 2>&1 | grep Apple >/dev/null || AS=gas
312
313AM_CONDITIONAL(FLaC__HAS_AS, test "$AS" = "as")
314AM_CONDITIONAL(FLaC__HAS_GAS, test "$AS" = "gas")
315if test "$AS" = "as" ; then
316AC_DEFINE(FLAC__HAS_AS)
317AH_TEMPLATE(FLAC__HAS_AS, [define if you are compiling for PowerPC and have the 'as' assembler])
318fi
319if test "$AS" = "gas" ; then
320# funniest. macro. ever.
321AC_DEFINE(FLAC__HAS_GAS)
322AH_TEMPLATE(FLAC__HAS_GAS, [define if you are compiling for PowerPC and have the 'gas' assembler])
323fi
324
325CPPFLAGS='-I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include'" $CPPFLAGS"
326if test "x$debug" = xtrue; then
327 CPPFLAGS="-DDEBUG -DFLaC__INLINE= $CPPFLAGS"
328 CFLAGS="-g $CFLAGS"
329else
330 CPPFLAGS="-DNDEBUG $CPPFLAGS"
331 # $ac_cv_c_inline from AC_C_INLINE
332 if test "x$ac_cv_c_inline" != xno ; then
333 CPPFLAGS="-DFLaC__INLINE=$ac_cv_c_inline $CPPFLAGS"
334 fi
335 if test "x$GCC" = xyes; then
336 CFLAGS="-O3 -funroll-loops -finline-functions -Wall -W -Winline $CFLAGS"
337 fi
338fi
339
340
341if test x$ac_cv_c_compiler_gnu = xyes ; then
342 if test x$enable_gcc_werror = "xyes" ; then
343 CFLAGS="-Werror $CFLAGS"
344 CXXFLAGS="-Werror $CXXFLAGS"
345 fi
346 fi
347
348
349#@@@
350AM_CONDITIONAL(FLaC__HAS_AS__TEMPORARILY_DISABLED, test "yes" = "no")
351AM_CONDITIONAL(FLaC__HAS_GAS__TEMPORARILY_DISABLED, test "yes" = "no")
352
353AC_CONFIG_FILES([ \
354 Makefile \
355 src/Makefile \
356 src/libFLAC/Makefile \
357 src/libFLAC/flac.pc \
358 src/libFLAC/ia32/Makefile \
359 src/libFLAC/ppc/Makefile \
360 src/libFLAC/ppc/as/Makefile \
361 src/libFLAC/ppc/gas/Makefile \
362 src/libFLAC/include/Makefile \
363 src/libFLAC/include/private/Makefile \
364 src/libFLAC/include/protected/Makefile \
365 src/libFLAC++/Makefile \
366 src/libFLAC++/flac++.pc \
367 src/flac/Makefile \
368 src/metaflac/Makefile \
369 src/monkeys_audio_utilities/Makefile \
370 src/monkeys_audio_utilities/flac_mac/Makefile \
371 src/monkeys_audio_utilities/flac_ren/Makefile \
372 src/plugin_common/Makefile \
373 src/plugin_winamp2/Makefile \
374 src/plugin_winamp2/include/Makefile \
375 src/plugin_winamp2/include/winamp2/Makefile \
376 src/plugin_xmms/Makefile \
377 src/share/Makefile \
378 src/share/getopt/Makefile \
379 src/share/grabbag/Makefile \
380 src/share/replaygain_analysis/Makefile \
381 src/share/replaygain_synthesis/Makefile \
382 src/share/replaygain_synthesis/include/Makefile \
383 src/share/replaygain_synthesis/include/private/Makefile \
384 src/share/utf8/Makefile \
385 src/test_grabbag/Makefile \
386 src/test_grabbag/cuesheet/Makefile \
387 src/test_grabbag/picture/Makefile \
388 src/test_libs_common/Makefile \
389 src/test_libFLAC/Makefile \
390 src/test_libFLAC++/Makefile \
391 src/test_seeking/Makefile \
392 src/test_streams/Makefile \
393 src/utils/Makefile \
394 src/utils/flacdiff/Makefile \
395 src/utils/flactimer/Makefile \
396 examples/Makefile \
397 examples/c/Makefile \
398 examples/c/decode/Makefile \
399 examples/c/decode/file/Makefile \
400 examples/c/encode/Makefile \
401 examples/c/encode/file/Makefile \
402 examples/cpp/Makefile \
403 examples/cpp/decode/Makefile \
404 examples/cpp/decode/file/Makefile \
405 examples/cpp/encode/Makefile \
406 examples/cpp/encode/file/Makefile \
407 include/Makefile \
408 include/FLAC/Makefile \
409 include/FLAC++/Makefile \
410 include/share/Makefile \
411 include/share/grabbag/Makefile \
412 include/test_libs_common/Makefile \
413 doc/Makefile \
414 doc/html/Makefile \
415 doc/html/images/Makefile \
416 doc/html/images/hw/Makefile \
417 doc/html/ru/Makefile \
418 m4/Makefile \
419 man/Makefile \
420 test/Makefile \
421 test/cuesheets/Makefile \
422 test/flac-to-flac-metadata-test-files/Makefile \
423 test/metaflac-test-files/Makefile \
424 test/pictures/Makefile \
425 build/Makefile \
426 obj/Makefile \
427 obj/debug/Makefile \
428 obj/debug/bin/Makefile \
429 obj/debug/lib/Makefile \
430 obj/release/Makefile \
431 obj/release/bin/Makefile \
432 obj/release/lib/Makefile \
433])
434AC_OUTPUT