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