blob: 19320a4eadbc00d59c6f4240a7e4e474878132c8 [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
Ulrich Klauercd4ddab2013-05-26 22:53:43 +02005# components distributed under different licenses. The codec libraries
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +11006# 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
Cristian Rodríguez9b7cb222012-04-07 19:24:21 -030021AC_PREREQ(2.60)
Erik de Castro Lopob1982fb2013-05-25 17:11:19 +100022AC_INIT([flac], [1.3.0], [flac-dev@xiph.org], [flac], [https://www.xiph.org/flac/])
Max Horn0b47ede2012-12-12 21:33:55 +010023AC_CONFIG_HEADERS([config.h])
Cristian Rodríguez9b7cb222012-04-07 19:24:21 -030024AC_CONFIG_SRCDIR([src/flac/main.c])
25AC_CONFIG_MACRO_DIR([m4])
Max Horn0b47ede2012-12-12 21:33:55 +010026AM_INIT_AUTOMAKE([foreign 1.11 -Wall tar-pax no-dist-gzip dist-xz subdir-objects])
Erik de Castro Lopo886b9602012-02-03 05:52:01 +110027m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110028
Miroslav Lichvar18e01542012-12-03 21:04:56 +010029user_cflags=$CFLAGS
30
Cristian Rodríguezf0296252012-04-05 19:39:37 -030031#Prefer whatever the current ISO standard is.
32AC_PROG_CC_STDC
33AC_USE_SYSTEM_EXTENSIONS
Cristian Rodríguez63c874f2012-06-02 17:00:56 -040034m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
Cristian Rodríguez9b7cb222012-04-07 19:24:21 -030035LT_INIT([win32-dll disable-static pic-only])
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110036AM_PROG_AS
37AC_PROG_CXX
Erik de Castro Lopoa6a4b6f2013-11-22 18:13:36 +110038XIPH_C_COMPILER_IS_CLANG
39XIPH_GCC_REALLY_IS_GCC
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110040AC_PROG_MAKE_SET
41
42AC_SYS_LARGEFILE
43AC_FUNC_FSEEKO
44
Erik de Castro Lopo6497ce12013-03-13 21:54:15 +110045AC_CHECK_SIZEOF(off_t,1) # Fake default value.
Max Horn0b47ede2012-12-12 21:33:55 +010046AC_CHECK_SIZEOF([void*])
Cristian Rodríguez9b7cb222012-04-07 19:24:21 -030047AC_SEARCH_LIBS([lround],[m], [AC_DEFINE(HAVE_LROUND,1,lround support)])
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110048
Max Horn0b47ede2012-12-12 21:33:55 +010049AC_LANG_PUSH([C++])
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110050# 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
Max Horn0b47ede2012-12-12 21:33:55 +010055AC_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 Lopoafedee12012-04-04 20:08:52 +100059AM_PROG_CC_C_O
Erik de Castro Lopo3abb6c92012-02-05 18:58:11 +110060AC_C_INLINE
61AC_C_VARARRAYS
Cristian Rodríguezf0296252012-04-05 19:39:37 -030062AC_C_TYPEOF
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110063
Erik de Castro Lopob72540b2013-09-15 09:42:29 +100064AC_CHECK_HEADERS([stdint.h inttypes.h byteswap.h sys/param.h termios.h x86intrin.h])
Dagobert Michelsen5999d812013-05-26 23:32:01 +020065
66AC_HEADER_TIOCGWINSZ
Cristian Rodríguezf0296252012-04-05 19:39:37 -030067
Erik de Castro Lopod7bfc772012-02-06 07:15:48 +110068XIPH_C_BSWAP32
69
Max Hornf20164e2012-12-12 21:33:51 +010070ac_cv_c_big_endian=0
71ac_cv_c_little_endian=0
72AC_C_BIGENDIAN([ac_cv_c_big_endian=1], [ac_cv_c_little_endian=1], [
73 AC_MSG_WARN([[*****************************************************************]])
74 AC_MSG_WARN([[*** Not able to determine endian-ness of target processor. ]])
75 AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in ]])
76 AC_MSG_WARN([[*** config.h may need to be hand editied. ]])
77 AC_MSG_WARN([[*****************************************************************]])
78])
Erik de Castro Lopo3abb6c92012-02-05 18:58:11 +110079AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
80 [Target processor is big endian.])
81AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
82 [Target processor is little endian.])
83AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, ${ac_cv_c_big_endian},
84 [Target processor is big endian.])
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110085
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +100086AC_ARG_ENABLE(asm-optimizations, AC_HELP_STRING([--disable-asm-optimizations], [Don't use any assembly optimization routines]), asm_opt=no, asm_opt=yes)
87dnl ' Terminate the damn single quote
88AM_CONDITIONAL(FLaC__NO_ASM, test "x$asm_opt" = xno)
89if test "x$asm_opt" = xno ; then
90AC_DEFINE(FLAC__NO_ASM)
91AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code])
92fi
93
Erik de Castro Lopo3abb6c92012-02-05 18:58:11 +110094# For the XMMS plugin.
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110095AC_CHECK_TYPES(socklen_t, [], [])
96
97dnl check for getopt in standard library
98dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
99AC_CHECK_FUNCS(getopt_long, [], [])
100
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000101AC_CHECK_SIZEOF(void*,1)
102
103asm_optimisation=no
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100104case "$host_cpu" in
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000105 x86_64)
106 if test $ac_cv_sizeof_voidp = 4 ; then
Erik de Castro Lopob72540b2013-09-15 09:42:29 +1000107 # This must be a 32 bit user space running on 64 bit kernel so treat
108 # this as ia32.
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000109 cpu_ia32=true
110 AC_DEFINE(FLAC__CPU_IA32)
111 AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
Erik de Castro Lopob72540b2013-09-15 09:42:29 +1000112 else
113 # x86_64 user space and kernel.
114 cpu_x86_64=true
115 AC_DEFINE(FLAC__CPU_X86_64)
116 AH_TEMPLATE(FLAC__CPU_X86_64, [define if building for x86_64])
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000117 fi
Erik de Castro Lopob72540b2013-09-15 09:42:29 +1000118 asm_optimisation=$asm_opt
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000119 ;;
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100120 i*86)
121 cpu_ia32=true
122 AC_DEFINE(FLAC__CPU_IA32)
123 AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000124 asm_optimisation=$asm_opt
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100125 ;;
Erik de Castro Lopo592021e2012-12-28 09:49:50 +1100126 powerpc|powerpc64)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100127 cpu_ppc=true
128 AC_DEFINE(FLAC__CPU_PPC)
129 AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC])
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000130 asm_optimisation=$asm_opt
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100131 ;;
132 sparc)
133 cpu_sparc=true
134 AC_DEFINE(FLAC__CPU_SPARC)
135 AH_TEMPLATE(FLAC__CPU_SPARC, [define if building for SPARC])
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000136 asm_optimisation=$asm_opt
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100137 ;;
138esac
Erik de Castro Lopob72540b2013-09-15 09:42:29 +1000139AM_CONDITIONAL(FLAC__CPU_X86_64, test "x$cpu_x86_64" = xtrue)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100140AM_CONDITIONAL(FLaC__CPU_IA32, test "x$cpu_ia32" = xtrue)
141AM_CONDITIONAL(FLaC__CPU_PPC, test "x$cpu_ppc" = xtrue)
142AM_CONDITIONAL(FLaC__CPU_SPARC, test "x$cpu_sparc" = xtrue)
143
Erik de Castro Lopob72540b2013-09-15 09:42:29 +1000144AC_DEFINE_UNQUOTED([FLAC__HAS_X86INTRIN],${HAVE_X86INTRIN_H}, [Set to 1 if <x86intrin.h> is available.])
145
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100146case "$host" in
147 i386-*-openbsd3.[[0-3]]) OBJ_FORMAT=aoutb ;;
148 *-*-cygwin|*mingw*) OBJ_FORMAT=win32 ;;
149 *-*-darwin*) OBJ_FORMAT=macho ;;
Erik de Castro Lopo0fe97672012-02-05 16:29:43 +1100150 *emx*) OBJ_FORMAT=aout ;;
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100151 *) OBJ_FORMAT=elf ;;
152esac
153AC_SUBST(OBJ_FORMAT)
Erik de Castro Lopob6e64af2012-02-13 19:46:32 +1100154case "$host" in
155 *-gnuspe)
156 abi_spe=true
157 AC_DEFINE(FLAC__CPU_PPC_SPE)
158 AH_TEMPLATE(FLAC__CPU_PPC_SPE, [define if building for PowerPC with SPE ABI])
159 ;;
160esac
161AM_CONDITIONAL(FLaC__CPU_PPC_SPE, test "x$abi_spe" = xtrue)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100162
Erik de Castro Lopo2199d082013-04-01 19:57:13 +1100163os_is_windows=no
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100164case "$host" in
Erik de Castro Lopoc1ebd2c2013-04-29 21:32:48 +1000165 *-*-cygwin|*mingw*)
Erik de Castro Lopof44c3532013-04-02 06:27:07 +1100166 CPPFLAGS="-D__MSVCRT_VERSION__=0x0601 $CPPFLAGS"
Erik de Castro Lopo2199d082013-04-01 19:57:13 +1100167 os_is_windows=yes
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100168 ;;
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100169esac
Cristian Rodríguez355f4aa2013-07-21 01:28:51 -0400170
Erik de Castro Lopo2199d082013-04-01 19:57:13 +1100171AM_CONDITIONAL(OS_IS_WINDOWS, test "x$os_is_windows" = xyes)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100172
173case "$host" in
174 *-pc-linux-gnu)
175 sys_linux=true
176 AC_DEFINE(FLAC__SYS_LINUX)
177 AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux])
178 ;;
179 *-*-darwin*)
180 sys_darwin=true
181 AC_DEFINE(FLAC__SYS_DARWIN)
182 AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X])
183 ;;
184esac
185AM_CONDITIONAL(FLaC__SYS_DARWIN, test "x$sys_darwin" = xtrue)
186AM_CONDITIONAL(FLaC__SYS_LINUX, test "x$sys_linux" = xtrue)
187
Erik de Castro Lopo899599e2013-09-25 23:26:49 +1000188if test "x$cpu_ia32" = xtrue || test "x$cpu_x86_64" = xtrue ; then
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100189AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
190AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA, [define to align allocated memory on 32-byte boundaries])
191fi
192
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100193AC_ARG_ENABLE(debug,
194AC_HELP_STRING([--enable-debug], [Turn on debugging]),
195[case "${enableval}" in
196 yes) debug=true ;;
197 no) debug=false ;;
198 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
199esac],[debug=false])
200AM_CONDITIONAL(DEBUG, test "x$debug" = xtrue)
201
202AC_ARG_ENABLE(sse,
203AC_HELP_STRING([--enable-sse], [Enable SSE support by asserting that the OS supports SSE instructions]),
204[case "${enableval}" in
205 yes) sse_os=true ;;
206 no) sse_os=false ;;
207 *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
208esac],[sse_os=false])
209AM_CONDITIONAL(FLaC__SSE_OS, test "x$sse_os" = xtrue)
210if test "x$sse_os" = xtrue ; then
211AC_DEFINE(FLAC__SSE_OS)
212AH_TEMPLATE(FLAC__SSE_OS, [define if your operating system supports SSE instructions])
213fi
214
215AC_ARG_ENABLE(3dnow,
216AC_HELP_STRING([--disable-3dnow], [Disable 3DNOW! optimizations]),
217[case "${enableval}" in
218 yes) use_3dnow=true ;;
219 no) use_3dnow=false ;;
220 *) AC_MSG_ERROR(bad value ${enableval} for --enable-3dnow) ;;
221esac],[use_3dnow=true])
222AM_CONDITIONAL(FLaC__USE_3DNOW, test "x$use_3dnow" = xtrue)
223if test "x$use_3dnow" = xtrue ; then
224AC_DEFINE(FLAC__USE_3DNOW)
225AH_TEMPLATE(FLAC__USE_3DNOW, [define to enable use of 3Dnow! instructions])
226fi
227
228AC_ARG_ENABLE(altivec,
229AC_HELP_STRING([--disable-altivec], [Disable Altivec optimizations]),
230[case "${enableval}" in
231 yes) use_altivec=true ;;
232 no) use_altivec=false ;;
233 *) AC_MSG_ERROR(bad value ${enableval} for --enable-altivec) ;;
234esac],[use_altivec=true])
235AM_CONDITIONAL(FLaC__USE_ALTIVEC, test "x$use_altivec" = xtrue)
236if test "x$use_altivec" = xtrue ; then
237AC_DEFINE(FLAC__USE_ALTIVEC)
238AH_TEMPLATE(FLAC__USE_ALTIVEC, [define to enable use of Altivec instructions])
239fi
240
241AC_ARG_ENABLE(thorough-tests,
242AC_HELP_STRING([--disable-thorough-tests], [Disable thorough (long) testing, do only basic tests]),
243[case "${enableval}" in
244 yes) thorough_tests=true ;;
245 no) thorough_tests=false ;;
246 *) AC_MSG_ERROR(bad value ${enableval} for --enable-thorough-tests) ;;
247esac],[thorough_tests=true])
248AC_ARG_ENABLE(exhaustive-tests,
249AC_HELP_STRING([--enable-exhaustive-tests], [Enable exhaustive testing (VERY long)]),
250[case "${enableval}" in
251 yes) exhaustive_tests=true ;;
252 no) exhaustive_tests=false ;;
253 *) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
254esac],[exhaustive_tests=false])
255if test "x$thorough_tests" = xfalse ; then
256FLAC__TEST_LEVEL=0
257elif test "x$exhaustive_tests" = xfalse ; then
258FLAC__TEST_LEVEL=1
259else
260FLAC__TEST_LEVEL=2
261fi
262AC_SUBST(FLAC__TEST_LEVEL)
263
264AC_ARG_ENABLE(gcc-werror,
Erik de Castro Lopo195470f2013-03-13 18:58:16 +1100265 AC_HELP_STRING([--enable-gcc-werror], [Enable -Werror in all Makefiles]))
266
267AC_ARG_ENABLE(stack-smash-protection,
268 AC_HELP_STRING([--enable-stack-smash-protection], [Enable GNU GCC stack smash protection]))
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100269
270AC_ARG_ENABLE(valgrind-testing,
271AC_HELP_STRING([--enable-valgrind-testing], [Run all tests inside Valgrind]),
272[case "${enableval}" in
273 yes) FLAC__TEST_WITH_VALGRIND=yes ;;
274 no) FLAC__TEST_WITH_VALGRIND=no ;;
275 *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind-testing) ;;
276esac],[FLAC__TEST_WITH_VALGRIND=no])
277AC_SUBST(FLAC__TEST_WITH_VALGRIND)
278
279AC_ARG_ENABLE(doxygen-docs,
280AC_HELP_STRING([--disable-doxygen-docs], [Disable API documentation building via Doxygen]),
281[case "${enableval}" in
282 yes) enable_doxygen_docs=true ;;
283 no) enable_doxygen_docs=false ;;
284 *) AC_MSG_ERROR(bad value ${enableval} for --enable-doxygen-docs) ;;
285esac],[enable_doxygen_docs=true])
286if test "x$enable_doxygen_docs" != xfalse ; then
287 AC_CHECK_PROGS(DOXYGEN, doxygen)
288fi
289AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
290
291AC_ARG_ENABLE(local-xmms-plugin,
292AC_HELP_STRING([--enable-local-xmms-plugin], [Install XMMS plugin to ~/.xmms/Plugins instead of system location]),
293[case "${enableval}" in
294 yes) install_xmms_plugin_locally=true ;;
295 no) install_xmms_plugin_locally=false ;;
296 *) AC_MSG_ERROR(bad value ${enableval} for --enable-local-xmms-plugin) ;;
297esac],[install_xmms_plugin_locally=false])
298AM_CONDITIONAL(FLaC__INSTALL_XMMS_PLUGIN_LOCALLY, test "x$install_xmms_plugin_locally" = xtrue)
299
300AC_ARG_ENABLE(xmms-plugin,
301AC_HELP_STRING([--disable-xmms-plugin], [Do not build XMMS plugin]),
302[case "${enableval}" in
303 yes) enable_xmms_plugin=true ;;
304 no) enable_xmms_plugin=false ;;
305 *) AC_MSG_ERROR(bad value ${enableval} for --enable-xmms-plugin) ;;
306esac],[enable_xmms_plugin=true])
307if test "x$enable_xmms_plugin" != xfalse ; then
308 AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - XMMS support will not be built]))
309fi
310AM_CONDITIONAL(FLaC__HAS_XMMS, test -n "$XMMS_INPUT_PLUGIN_DIR")
311
312dnl build FLAC++ or not
313AC_ARG_ENABLE([cpplibs],
314AC_HELP_STRING([--disable-cpplibs], [Do not build libFLAC++]),
315[case "${enableval}" in
316 yes) disable_cpplibs=false ;;
317 no) disable_cpplibs=true ;;
318 *) AC_MSG_ERROR(bad value ${enableval} for --enable-cpplibs) ;;
319esac], [disable_cpplibs=false])
320AM_CONDITIONAL(FLaC__WITH_CPPLIBS, [test "x$disable_cpplibs" != xtrue])
321
322dnl check for ogg library
323AC_ARG_ENABLE([ogg],
324 AC_HELP_STRING([--disable-ogg], [Disable ogg support (default: test for libogg)]),
325 [ want_ogg=$enableval ], [ want_ogg=yes ] )
326
327if test "x$want_ogg" != "xno"; then
328 XIPH_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development enviroment not installed - Ogg support will not be built]))
329fi
330
331AM_CONDITIONAL(FLaC__HAS_OGG, [test "x$have_ogg" = xyes])
332if test "x$have_ogg" = xyes ; then
Erik de Castro Lopo3e2cd272012-07-04 19:53:31 +1000333 AC_DEFINE_UNQUOTED([FLAC__HAS_OGG],1,[define if you have the ogg library])
Ulrich Klauer5da86632013-04-06 20:41:12 +0200334 OGG_PACKAGE="ogg"
Erik de Castro Lopo3e2cd272012-07-04 19:53:31 +1000335else
336 AC_DEFINE_UNQUOTED([FLAC__HAS_OGG],0)
Erik de Castro Lopoe21237a2013-09-15 19:58:05 +1000337 have_ogg=no
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100338fi
Ulrich Klauer5da86632013-04-06 20:41:12 +0200339AC_SUBST(OGG_PACKAGE)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100340
341dnl check for i18n(internationalization); these are from libiconv/gettext
342AM_ICONV
343AM_LANGINFO_CODESET
344
345AC_CHECK_PROGS(DOCBOOK_TO_MAN, docbook-to-man docbook2man)
346AM_CONDITIONAL(FLaC__HAS_DOCBOOK_TO_MAN, test -n "$DOCBOOK_TO_MAN")
347if test -n "$DOCBOOK_TO_MAN" ; then
348AC_DEFINE(FLAC__HAS_DOCBOOK_TO_MAN)
349AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN, [define if you have docbook-to-man or docbook2man])
350fi
351
352# only matters for x86
353AC_CHECK_PROGS(NASM, nasm)
354AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
355if test -n "$NASM" ; then
356AC_DEFINE(FLAC__HAS_NASM)
357AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler])
358fi
359
360# only matters for PowerPC
361AC_CHECK_PROGS(AS, as, as)
362AC_CHECK_PROGS(GAS, gas, gas)
363
364# try -v (apple as) and --version (gas) at the same time
365test "$AS" = "as" && as --version -v < /dev/null 2>&1 | grep Apple >/dev/null || AS=gas
366
367AM_CONDITIONAL(FLaC__HAS_AS, test "$AS" = "as")
368AM_CONDITIONAL(FLaC__HAS_GAS, test "$AS" = "gas")
369if test "$AS" = "as" ; then
370AC_DEFINE(FLAC__HAS_AS)
371AH_TEMPLATE(FLAC__HAS_AS, [define if you are compiling for PowerPC and have the 'as' assembler])
372fi
373if test "$AS" = "gas" ; then
374# funniest. macro. ever.
375AC_DEFINE(FLAC__HAS_GAS)
376AH_TEMPLATE(FLAC__HAS_GAS, [define if you are compiling for PowerPC and have the 'gas' assembler])
377fi
378
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100379if test "x$debug" = xtrue; then
Cristian Rodríguez9b7cb222012-04-07 19:24:21 -0300380 CPPFLAGS="-DDEBUG $CPPFLAGS"
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100381 CFLAGS="-g $CFLAGS"
382else
383 CPPFLAGS="-DNDEBUG $CPPFLAGS"
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100384 if test "x$GCC" = xyes; then
Miroslav Lichvar18e01542012-12-03 21:04:56 +0100385 if test "x$user_cflags" = x; then
386 CFLAGS="-O3 -funroll-loops -Wall -W -Winline"
387 fi
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100388 fi
389fi
390
Erik de Castro Lopocaef93e2012-02-26 22:41:44 +1100391XIPH_GCC_VERSION
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100392
393if test x$ac_cv_c_compiler_gnu = xyes ; then
Erik de Castro Lopo24a64472013-09-15 18:09:48 +1000394 CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations " # -Wcast-qual -Wbad-function-cast -Wwrite-strings -Winline -Wconversion
395 CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wsign-promo -Wundef " # -Wcast-qual -Wbad-function-cast -Wwrite-strings -Woverloaded-virtual -Wmissing-declarations
Erik de Castro Lopo06f38122013-03-10 22:34:18 +1100396
397
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100398 if test x$enable_gcc_werror = "xyes" ; then
Erik de Castro Lopo24a64472013-09-15 18:09:48 +1000399 CFLAGS="$CFLAGS -Werror "
400 CXXFLAGS="$CXXFLAGS -Werror "
Erik de Castro Lopo2860f172013-03-09 19:42:26 +1100401 fi
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100402
Erik de Castro Lopo24a64472013-09-15 18:09:48 +1000403 XIPH_ADD_CFLAGS([-Wdeclaration-after-statement])
404 XIPH_ADD_CFLAGS([-D_FORTIFY_SOURCE=2])
405
406 AC_LANG_PUSH([C++])
407 XIPH_ADD_CXXFLAGS([-Weffc++])
408 AC_LANG_POP([C++])
409
Miroslav Lichvar19c78e52012-12-03 21:04:57 +0100410 if test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = elf; then
411 CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
412 CFLAGS="$CFLAGS -fvisibility=hidden"
413 CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
Erik de Castro Lopo2860f172013-03-09 19:42:26 +1100414 fi
415
416 if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x42" ; then
417 XIPH_ADD_CFLAGS([-fgnu89-inline])
418 fi
Erik de Castro Lopo24a64472013-09-15 18:09:48 +1000419
Erik de Castro Lopoae4d7202013-09-15 20:34:40 +1000420 if test "x$asm_optimisation" = "xyes" ; then
Erik de Castro Lopoae4d7202013-09-15 20:34:40 +1000421 XIPH_ADD_CFLAGS([-msse2])
422 fi
423
Miroslav Lichvar19c78e52012-12-03 21:04:57 +0100424 fi
Miroslav Lichvar19c78e52012-12-03 21:04:57 +0100425
Erik de Castro Lopod5b03bc2013-03-09 08:55:37 +1100426XIPH_ADD_CFLAGS([-Wextra])
Erik de Castro Lopod5b03bc2013-03-09 08:55:37 +1100427
Erik de Castro Lopo195470f2013-03-13 18:58:16 +1100428if test x$enable_stack_smash_protection = "xyes" ; then
429 XIPH_GCC_STACK_PROTECTOR
430 XIPH_GXX_STACK_PROTECTOR
431 fi
Erik de Castro Lopod5b03bc2013-03-09 08:55:37 +1100432
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100433#@@@
434AM_CONDITIONAL(FLaC__HAS_AS__TEMPORARILY_DISABLED, test "yes" = "no")
435AM_CONDITIONAL(FLaC__HAS_GAS__TEMPORARILY_DISABLED, test "yes" = "no")
436
437AC_CONFIG_FILES([ \
438 Makefile \
439 src/Makefile \
440 src/libFLAC/Makefile \
441 src/libFLAC/flac.pc \
442 src/libFLAC/ia32/Makefile \
443 src/libFLAC/ppc/Makefile \
444 src/libFLAC/ppc/as/Makefile \
445 src/libFLAC/ppc/gas/Makefile \
446 src/libFLAC/include/Makefile \
447 src/libFLAC/include/private/Makefile \
448 src/libFLAC/include/protected/Makefile \
449 src/libFLAC++/Makefile \
450 src/libFLAC++/flac++.pc \
451 src/flac/Makefile \
452 src/metaflac/Makefile \
453 src/monkeys_audio_utilities/Makefile \
454 src/monkeys_audio_utilities/flac_mac/Makefile \
455 src/monkeys_audio_utilities/flac_ren/Makefile \
456 src/plugin_common/Makefile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100457 src/plugin_xmms/Makefile \
458 src/share/Makefile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100459 src/test_grabbag/Makefile \
460 src/test_grabbag/cuesheet/Makefile \
461 src/test_grabbag/picture/Makefile \
462 src/test_libs_common/Makefile \
463 src/test_libFLAC/Makefile \
464 src/test_libFLAC++/Makefile \
465 src/test_seeking/Makefile \
466 src/test_streams/Makefile \
467 src/utils/Makefile \
468 src/utils/flacdiff/Makefile \
469 src/utils/flactimer/Makefile \
470 examples/Makefile \
471 examples/c/Makefile \
472 examples/c/decode/Makefile \
473 examples/c/decode/file/Makefile \
474 examples/c/encode/Makefile \
475 examples/c/encode/file/Makefile \
476 examples/cpp/Makefile \
477 examples/cpp/decode/Makefile \
478 examples/cpp/decode/file/Makefile \
479 examples/cpp/encode/Makefile \
480 examples/cpp/encode/file/Makefile \
481 include/Makefile \
482 include/FLAC/Makefile \
483 include/FLAC++/Makefile \
484 include/share/Makefile \
485 include/share/grabbag/Makefile \
486 include/test_libs_common/Makefile \
Olivier Blinf6997882012-12-28 19:58:46 +0100487 doc/Doxyfile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100488 doc/Makefile \
489 doc/html/Makefile \
490 doc/html/images/Makefile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100491 m4/Makefile \
492 man/Makefile \
Erik de Castro Lopoa9712a22013-09-16 19:55:11 +1000493 test/common.sh \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100494 test/Makefile \
495 test/cuesheets/Makefile \
496 test/flac-to-flac-metadata-test-files/Makefile \
497 test/metaflac-test-files/Makefile \
498 test/pictures/Makefile \
499 build/Makefile \
Erik de Castro Lopo55788ea2012-12-28 11:06:38 +1100500 objs/Makefile \
501 objs/debug/Makefile \
502 objs/debug/bin/Makefile \
503 objs/debug/lib/Makefile \
504 objs/release/Makefile \
505 objs/release/bin/Makefile \
506 objs/release/lib/Makefile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100507])
508AC_OUTPUT
Erik de Castro Lopocaef93e2012-02-26 22:41:44 +1100509
510AC_MSG_RESULT([
511-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
512
513 Configuration summary :
514
515 FLAC version : ........................ ${VERSION}
516
517 Host CPU : ............................ ${host_cpu}
518 Host Vendor : ......................... ${host_vendor}
519 Host OS : ............................. ${host_os}
520])
521
Erik de Castro Lopocaef93e2012-02-26 22:41:44 +1100522 echo " Compiler is GCC : ..................... ${ac_cv_c_compiler_gnu}"
Max Horncdcb88b2012-12-12 21:33:53 +0100523if test x$ac_cv_c_compiler_gnu = xyes ; then
Erik de Castro Lopocaef93e2012-02-26 22:41:44 +1100524 echo " GCC version : ......................... ${GCC_VERSION}"
Max Horncdcb88b2012-12-12 21:33:53 +0100525fi
Erik de Castro Lopoa6a4b6f2013-11-22 18:13:36 +1100526 echo " Compiler is Clang : ................... ${xiph_cv_c_compiler_clang}"
Erik de Castro Lopo899599e2013-09-25 23:26:49 +1000527 echo " Asm optimizations : ................... ${asm_optimisation}"
Erik de Castro Lopoe21237a2013-09-15 19:58:05 +1000528 echo " Ogg/FLAC support : .................... ${have_ogg}"
Erik de Castro Lopo592021e2012-12-28 09:49:50 +1100529echo