1 # FLAC - Free Lossless Audio Codec
2 # Copyright (C) 2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson
4 # This file is part the FLAC project. FLAC is comprised of several
5 # components distributed under different 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
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
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
22 AC_INIT([flac], [1.3.1pre1], [flac-dev@xiph.org], [flac], [https://www.xiph.org/flac/])
23 AC_CONFIG_HEADERS([config.h])
24 AC_CONFIG_SRCDIR([src/flac/main.c])
25 AC_CONFIG_MACRO_DIR([m4])
26 AM_INIT_AUTOMAKE([foreign 1.11 -Wall tar-pax no-dist-gzip dist-xz subdir-objects])
27 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
31 #Prefer whatever the current ISO standard is.
33 AC_USE_SYSTEM_EXTENSIONS
34 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
35 LT_INIT([win32-dll disable-static pic-only])
38 XIPH_C_COMPILER_IS_CLANG
39 XIPH_GCC_REALLY_IS_GCC
46 AC_CHECK_SIZEOF(off_t,1) # Fake default value.
47 AC_CHECK_SIZEOF([void*])
48 AC_SEARCH_LIBS([lround],[m], [AC_DEFINE(HAVE_LROUND,1,lround support)])
53 if test $ac_cv_c_vararrays = yes; then
54 AC_DEFINE([HAVE_CXX_VARARRAYS], 1, [Define to 1 if C++ supports variable-length arrays.])
65 AC_CHECK_HEADERS([stdint.h inttypes.h byteswap.h sys/param.h termios.h x86intrin.h cpuid.h])
73 ac_cv_c_little_endian=0
74 AC_C_BIGENDIAN([ac_cv_c_big_endian=1], [ac_cv_c_little_endian=1], [
75 AC_MSG_WARN([[*****************************************************************]])
76 AC_MSG_WARN([[*** Not able to determine endian-ness of target processor. ]])
77 AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in ]])
78 AC_MSG_WARN([[*** config.h may need to be hand editied. ]])
79 AC_MSG_WARN([[*****************************************************************]])
81 AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
82 [Target processor is big endian.])
83 AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
84 [Target processor is little endian.])
85 AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, ${ac_cv_c_big_endian},
86 [Target processor is big endian.])
88 AC_ARG_ENABLE(asm-optimizations, AC_HELP_STRING([--disable-asm-optimizations], [Don't use any assembly optimization routines]), asm_opt=no, asm_opt=yes)
89 dnl ' Terminate the damn single quote
90 AM_CONDITIONAL(FLaC__NO_ASM, test "x$asm_opt" = xno)
91 if test "x$asm_opt" = xno ; then
92 AC_DEFINE(FLAC__NO_ASM)
93 AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code])
96 # For the XMMS plugin.
97 AC_CHECK_TYPES(socklen_t, [], [])
99 dnl check for getopt in standard library
100 dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
101 AC_CHECK_FUNCS(getopt_long, [], [])
103 AC_CHECK_SIZEOF(void*,1)
108 if test $ac_cv_sizeof_voidp = 4 ; then
109 # This must be a 32 bit user space running on 64 bit kernel so treat
112 AC_DEFINE(FLAC__CPU_IA32)
113 AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
115 # x86_64 user space and kernel.
117 AC_DEFINE(FLAC__CPU_X86_64)
118 AH_TEMPLATE(FLAC__CPU_X86_64, [define if building for x86_64])
120 asm_optimisation=$asm_opt
124 AC_DEFINE(FLAC__CPU_IA32)
125 AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
126 asm_optimisation=$asm_opt
130 AC_DEFINE(FLAC__CPU_PPC)
131 AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC])
132 asm_optimisation=$asm_opt
136 AC_DEFINE(FLAC__CPU_SPARC)
137 AH_TEMPLATE(FLAC__CPU_SPARC, [define if building for SPARC])
138 asm_optimisation=$asm_opt
141 AM_CONDITIONAL(FLAC__CPU_X86_64, test "x$cpu_x86_64" = xtrue)
142 AM_CONDITIONAL(FLaC__CPU_IA32, test "x$cpu_ia32" = xtrue)
143 AM_CONDITIONAL(FLaC__CPU_PPC, test "x$cpu_ppc" = xtrue)
144 AM_CONDITIONAL(FLaC__CPU_SPARC, test "x$cpu_sparc" = xtrue)
146 AC_DEFINE_UNQUOTED([FLAC__HAS_X86INTRIN],${HAVE_X86INTRIN_H}, [Set to 1 if <x86intrin.h> is available.])
149 i386-*-openbsd3.[[0-3]]) OBJ_FORMAT=aoutb ;;
150 *-*-cygwin|*mingw*) OBJ_FORMAT=win32 ;;
151 *-*-darwin*) OBJ_FORMAT=macho ;;
152 *emx*) OBJ_FORMAT=aout ;;
159 AC_DEFINE(FLAC__CPU_PPC_SPE)
160 AH_TEMPLATE(FLAC__CPU_PPC_SPE, [define if building for PowerPC with SPE ABI])
163 AM_CONDITIONAL(FLaC__CPU_PPC_SPE, test "x$abi_spe" = xtrue)
168 CPPFLAGS="-D__MSVCRT_VERSION__=0x0601 $CPPFLAGS"
173 AM_CONDITIONAL(OS_IS_WINDOWS, test "x$os_is_windows" = xyes)
178 AC_DEFINE(FLAC__SYS_LINUX)
179 AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux])
183 AC_DEFINE(FLAC__SYS_DARWIN)
184 AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X])
187 AM_CONDITIONAL(FLaC__SYS_DARWIN, test "x$sys_darwin" = xtrue)
188 AM_CONDITIONAL(FLaC__SYS_LINUX, test "x$sys_linux" = xtrue)
190 if test "x$cpu_ia32" = xtrue || test "x$cpu_x86_64" = xtrue ; then
191 AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
192 AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA, [define to align allocated memory on 32-byte boundaries])
196 AC_HELP_STRING([--enable-debug], [Turn on debugging]),
197 [case "${enableval}" in
200 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
202 AM_CONDITIONAL(DEBUG, test "x$debug" = xtrue)
205 AC_HELP_STRING([--disable-sse], [Disable SSE if the OS does not support SSE instructions]),
206 [case "${enableval}" in
209 *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
211 AM_CONDITIONAL(FLaC__SSE_OS, test "x$sse_os" = xtrue)
212 if test "x$sse_os" = xyes ; then
213 AC_DEFINE(FLAC__SSE_OS)
214 AH_TEMPLATE(FLAC__SSE_OS, [define if your operating system supports SSE instructions])
217 AC_ARG_ENABLE(altivec,
218 AC_HELP_STRING([--disable-altivec], [Disable Altivec optimizations]),
219 [case "${enableval}" in
220 yes) use_altivec=true ;;
221 no) use_altivec=false ;;
222 *) AC_MSG_ERROR(bad value ${enableval} for --enable-altivec) ;;
223 esac],[use_altivec=true])
224 AM_CONDITIONAL(FLaC__USE_ALTIVEC, test "x$use_altivec" = xtrue)
225 if test "x$use_altivec" = xtrue ; then
226 AC_DEFINE(FLAC__USE_ALTIVEC)
227 AH_TEMPLATE(FLAC__USE_ALTIVEC, [define to enable use of Altivec instructions])
230 AC_ARG_ENABLE(thorough-tests,
231 AC_HELP_STRING([--disable-thorough-tests], [Disable thorough (long) testing, do only basic tests]),
232 [case "${enableval}" in
233 yes) thorough_tests=true ;;
234 no) thorough_tests=false ;;
235 *) AC_MSG_ERROR(bad value ${enableval} for --enable-thorough-tests) ;;
236 esac],[thorough_tests=true])
237 AC_ARG_ENABLE(exhaustive-tests,
238 AC_HELP_STRING([--enable-exhaustive-tests], [Enable exhaustive testing (VERY long)]),
239 [case "${enableval}" in
240 yes) exhaustive_tests=true ;;
241 no) exhaustive_tests=false ;;
242 *) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
243 esac],[exhaustive_tests=false])
244 if test "x$thorough_tests" = xfalse ; then
246 elif test "x$exhaustive_tests" = xfalse ; then
251 AC_SUBST(FLAC__TEST_LEVEL)
253 AC_ARG_ENABLE(werror,
254 AC_HELP_STRING([--enable-werror], [Enable -Werror in all Makefiles]))
256 AC_ARG_ENABLE(stack-smash-protection,
257 AC_HELP_STRING([--enable-stack-smash-protection], [Enable GNU GCC stack smash protection]))
259 AC_ARG_ENABLE(valgrind-testing,
260 AC_HELP_STRING([--enable-valgrind-testing], [Run all tests inside Valgrind]),
261 [case "${enableval}" in
262 yes) FLAC__TEST_WITH_VALGRIND=yes ;;
263 no) FLAC__TEST_WITH_VALGRIND=no ;;
264 *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind-testing) ;;
265 esac],[FLAC__TEST_WITH_VALGRIND=no])
266 AC_SUBST(FLAC__TEST_WITH_VALGRIND)
268 AC_ARG_ENABLE(doxygen-docs,
269 AC_HELP_STRING([--disable-doxygen-docs], [Disable API documentation building via Doxygen]),
270 [case "${enableval}" in
271 yes) enable_doxygen_docs=true ;;
272 no) enable_doxygen_docs=false ;;
273 *) AC_MSG_ERROR(bad value ${enableval} for --enable-doxygen-docs) ;;
274 esac],[enable_doxygen_docs=true])
275 if test "x$enable_doxygen_docs" != xfalse ; then
276 AC_CHECK_PROGS(DOXYGEN, doxygen)
278 AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
280 AC_ARG_ENABLE(local-xmms-plugin,
281 AC_HELP_STRING([--enable-local-xmms-plugin], [Install XMMS plugin to ~/.xmms/Plugins instead of system location]),
282 [case "${enableval}" in
283 yes) install_xmms_plugin_locally=true ;;
284 no) install_xmms_plugin_locally=false ;;
285 *) AC_MSG_ERROR(bad value ${enableval} for --enable-local-xmms-plugin) ;;
286 esac],[install_xmms_plugin_locally=false])
287 AM_CONDITIONAL(FLaC__INSTALL_XMMS_PLUGIN_LOCALLY, test "x$install_xmms_plugin_locally" = xtrue)
289 AC_ARG_ENABLE(xmms-plugin,
290 AC_HELP_STRING([--disable-xmms-plugin], [Do not build XMMS plugin]),
291 [case "${enableval}" in
292 yes) enable_xmms_plugin=true ;;
293 no) enable_xmms_plugin=false ;;
294 *) AC_MSG_ERROR(bad value ${enableval} for --enable-xmms-plugin) ;;
295 esac],[enable_xmms_plugin=true])
296 if test "x$enable_xmms_plugin" != xfalse ; then
297 AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - XMMS support will not be built]))
299 AM_CONDITIONAL(FLaC__HAS_XMMS, test -n "$XMMS_INPUT_PLUGIN_DIR")
301 dnl build FLAC++ or not
302 AC_ARG_ENABLE([cpplibs],
303 AC_HELP_STRING([--disable-cpplibs], [Do not build libFLAC++]),
304 [case "${enableval}" in
305 yes) disable_cpplibs=false ;;
306 no) disable_cpplibs=true ;;
307 *) AC_MSG_ERROR(bad value ${enableval} for --enable-cpplibs) ;;
308 esac], [disable_cpplibs=false])
309 AM_CONDITIONAL(FLaC__WITH_CPPLIBS, [test "x$disable_cpplibs" != xtrue])
311 dnl check for ogg library
313 AC_HELP_STRING([--disable-ogg], [Disable ogg support (default: test for libogg)]),
314 [ want_ogg=$enableval ], [ want_ogg=yes ] )
316 if test "x$want_ogg" != "xno"; then
317 XIPH_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development enviroment not installed - Ogg support will not be built]))
320 AM_CONDITIONAL(FLaC__HAS_OGG, [test "x$have_ogg" = xyes])
321 if test "x$have_ogg" = xyes ; then
322 AC_DEFINE_UNQUOTED([FLAC__HAS_OGG],1,[define if you have the ogg library])
325 AC_DEFINE_UNQUOTED([FLAC__HAS_OGG],0)
328 AC_SUBST(OGG_PACKAGE)
330 dnl check for i18n(internationalization); these are from libiconv/gettext
334 AC_CHECK_PROGS(DOCBOOK_TO_MAN, docbook-to-man docbook2man)
335 AM_CONDITIONAL(FLaC__HAS_DOCBOOK_TO_MAN, test -n "$DOCBOOK_TO_MAN")
336 if test -n "$DOCBOOK_TO_MAN" ; then
337 AC_DEFINE(FLAC__HAS_DOCBOOK_TO_MAN)
338 AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN, [define if you have docbook-to-man or docbook2man])
341 # only matters for x86
342 AC_CHECK_PROGS(NASM, nasm)
343 AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
344 if test -n "$NASM" ; then
345 AC_DEFINE(FLAC__HAS_NASM)
346 AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler])
349 if test "x$debug" = xtrue; then
350 CPPFLAGS="-DDEBUG $CPPFLAGS"
351 CFLAGS=$(echo "$CFLAGS" | sed 's/-g//')
354 CPPFLAGS="-DNDEBUG $CPPFLAGS"
355 CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//;s/-g//')
356 CFLAGS="-O3 -funroll-loops $CFLAGS"
361 if test x$ac_cv_c_compiler_gnu = xyes ; then
362 CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Wunreachable-code -Winline " # -Wcast-qual -Wbad-function-cast -Wwrite-strings -Wconversion
363 CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wsign-promo -Wundef -Wunreachable-code " # -Wcast-qual -Wbad-function-cast -Wwrite-strings -Woverloaded-virtual -Wmissing-declarations
365 XIPH_ADD_CFLAGS([-Wdeclaration-after-statement])
366 XIPH_ADD_CFLAGS([-D_FORTIFY_SOURCE=2])
369 XIPH_ADD_CXXFLAGS([-Weffc++])
372 if test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = elf; then
373 CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
374 CFLAGS="$CFLAGS -fvisibility=hidden"
375 CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
378 if test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = macho; then
379 CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
380 CFLAGS="$CFLAGS -fvisibility=hidden"
381 CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
384 if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x42" ; then
385 XIPH_ADD_CFLAGS([-fgnu89-inline])
388 if test "x$asm_optimisation$sse_os" = "xyesyes" ; then
389 XIPH_ADD_CFLAGS([-msse2])
394 XIPH_ADD_CFLAGS([-Wextra])
396 if test x$enable_werror = "xyes" ; then
397 XIPH_ADD_CFLAGS([-Werror])
399 XIPH_ADD_CXXFLAGS([-Werror])
403 if test x$enable_stack_smash_protection = "xyes" ; then
404 XIPH_GCC_STACK_PROTECTOR
405 XIPH_GXX_STACK_PROTECTOR
411 src/libFLAC/Makefile \
412 src/libFLAC/flac.pc \
413 src/libFLAC/ia32/Makefile \
414 src/libFLAC/include/Makefile \
415 src/libFLAC/include/private/Makefile \
416 src/libFLAC/include/protected/Makefile \
417 src/libFLAC++/Makefile \
418 src/libFLAC++/flac++.pc \
420 src/metaflac/Makefile \
421 src/plugin_common/Makefile \
422 src/plugin_xmms/Makefile \
424 src/test_grabbag/Makefile \
425 src/test_grabbag/cuesheet/Makefile \
426 src/test_grabbag/picture/Makefile \
427 src/test_libs_common/Makefile \
428 src/test_libFLAC/Makefile \
429 src/test_libFLAC++/Makefile \
430 src/test_seeking/Makefile \
431 src/test_streams/Makefile \
433 src/utils/flacdiff/Makefile \
434 src/utils/flactimer/Makefile \
436 examples/c/Makefile \
437 examples/c/decode/Makefile \
438 examples/c/decode/file/Makefile \
439 examples/c/encode/Makefile \
440 examples/c/encode/file/Makefile \
441 examples/cpp/Makefile \
442 examples/cpp/decode/Makefile \
443 examples/cpp/decode/file/Makefile \
444 examples/cpp/encode/Makefile \
445 examples/cpp/encode/file/Makefile \
447 include/FLAC/Makefile \
448 include/FLAC++/Makefile \
449 include/share/Makefile \
450 include/share/grabbag/Makefile \
451 include/test_libs_common/Makefile \
455 doc/html/images/Makefile \
460 test/cuesheets/Makefile \
461 test/flac-to-flac-metadata-test-files/Makefile \
462 test/metaflac-test-files/Makefile \
463 test/pictures/Makefile \
466 objs/debug/Makefile \
467 objs/debug/bin/Makefile \
468 objs/debug/lib/Makefile \
469 objs/release/Makefile \
470 objs/release/bin/Makefile \
471 objs/release/lib/Makefile \
476 -=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
478 Configuration summary :
480 FLAC version : ........................ ${VERSION}
482 Host CPU : ............................ ${host_cpu}
483 Host Vendor : ......................... ${host_vendor}
484 Host OS : ............................. ${host_os}
487 echo " Compiler is GCC : ..................... ${ac_cv_c_compiler_gnu}"
488 if test x$ac_cv_c_compiler_gnu = xyes ; then
489 echo " GCC version : ......................... ${GCC_VERSION}"
491 echo " Compiler is Clang : ................... ${xiph_cv_c_compiler_clang}"
492 echo " SSE optimizations : ................... ${sse_os}"
493 echo " Asm optimizations : ................... ${asm_optimisation}"
494 echo " Ogg/FLAC support : .................... ${have_ogg}"