blob: 993ac3363e37f2abc264a63dede8057fdfc89434 [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 Lopo0e11f732014-11-27 14:04:48 +110022AC_INIT([flac], [1.3.1], [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])
Erik de Castro Lopo723cfa32014-12-01 05:28:02 +110026AM_INIT_AUTOMAKE([foreign 1.10 -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
Erik de Castro Lopo95bc23a2014-03-21 18:27:37 +110041AC_PROG_MKDIR_P
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110042
43AC_SYS_LARGEFILE
44AC_FUNC_FSEEKO
45
Erik de Castro Lopo6497ce12013-03-13 21:54:15 +110046AC_CHECK_SIZEOF(off_t,1) # Fake default value.
Max Horn0b47ede2012-12-12 21:33:55 +010047AC_CHECK_SIZEOF([void*])
Cristian Rodríguez9b7cb222012-04-07 19:24:21 -030048AC_SEARCH_LIBS([lround],[m], [AC_DEFINE(HAVE_LROUND,1,lround support)])
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110049
Max Horn0b47ede2012-12-12 21:33:55 +010050AC_LANG_PUSH([C++])
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110051# c++ flavor first
52AC_C_VARARRAYS
53if test $ac_cv_c_vararrays = yes; then
54 AC_DEFINE([HAVE_CXX_VARARRAYS], 1, [Define to 1 if C++ supports variable-length arrays.])
55fi
Max Horn0b47ede2012-12-12 21:33:55 +010056AC_LANG_POP([C++])
Erik de Castro Lopo3abb6c92012-02-05 18:58:11 +110057
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110058# c flavor
59AC_HEADER_STDC
Erik de Castro Lopoafedee12012-04-04 20:08:52 +100060AM_PROG_CC_C_O
Erik de Castro Lopo3abb6c92012-02-05 18:58:11 +110061AC_C_INLINE
62AC_C_VARARRAYS
Cristian Rodríguezf0296252012-04-05 19:39:37 -030063AC_C_TYPEOF
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110064
Erik de Castro Lopod7e6d912014-03-21 17:45:18 +110065AC_CHECK_HEADERS([stdint.h inttypes.h byteswap.h sys/param.h termios.h x86intrin.h cpuid.h])
Dagobert Michelsen5999d812013-05-26 23:32:01 +020066
67AC_HEADER_TIOCGWINSZ
Cristian Rodríguezf0296252012-04-05 19:39:37 -030068
Erik de Castro Lopod7bfc772012-02-06 07:15:48 +110069XIPH_C_BSWAP32
Ralph Giles7a671e72014-11-04 11:58:45 -080070XIPH_C_BSWAP16
Erik de Castro Lopod7bfc772012-02-06 07:15:48 +110071
Max Hornf20164e2012-12-12 21:33:51 +010072ac_cv_c_big_endian=0
73ac_cv_c_little_endian=0
74AC_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([[*****************************************************************]])
80])
Erik de Castro Lopo3abb6c92012-02-05 18:58:11 +110081AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
82 [Target processor is big endian.])
83AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
84 [Target processor is little endian.])
85AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, ${ac_cv_c_big_endian},
86 [Target processor is big endian.])
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110087
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +100088AC_ARG_ENABLE(asm-optimizations, AC_HELP_STRING([--disable-asm-optimizations], [Don't use any assembly optimization routines]), asm_opt=no, asm_opt=yes)
89dnl ' Terminate the damn single quote
90AM_CONDITIONAL(FLaC__NO_ASM, test "x$asm_opt" = xno)
91if test "x$asm_opt" = xno ; then
92AC_DEFINE(FLAC__NO_ASM)
93AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code])
94fi
95
Erik de Castro Lopo3abb6c92012-02-05 18:58:11 +110096# For the XMMS plugin.
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +110097AC_CHECK_TYPES(socklen_t, [], [])
98
99dnl check for getopt in standard library
100dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
101AC_CHECK_FUNCS(getopt_long, [], [])
102
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000103AC_CHECK_SIZEOF(void*,1)
104
105asm_optimisation=no
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100106case "$host_cpu" in
Christian Weisgerberb5a10e72015-01-09 22:37:37 +0000107 amd64|x86_64)
Erik de Castro Lopo7566d3d2015-03-11 20:51:42 +1100108 case "$host" in
109 *gnux32)
110 # x32 user space and 64 bit kernel.
111 cpu_x86_64=true
112 AC_DEFINE(FLAC__CPU_X86_64)
113 AH_TEMPLATE(FLAC__CPU_X86_64, [define if building for x86_64])
114 asm_optimisation=$asm_opt
115 ;;
116 *)
117 if test $ac_cv_sizeof_voidp = 4 ; then
118 # This must be a 32 bit user space running on 64 bit kernel so treat
119 # this as ia32.
120 cpu_ia32=true
121 AC_DEFINE(FLAC__CPU_IA32)
122 AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
123 else
124 # x86_64 user space and kernel.
125 cpu_x86_64=true
126 AC_DEFINE(FLAC__CPU_X86_64)
127 AH_TEMPLATE(FLAC__CPU_X86_64, [define if building for x86_64])
128 fi
129 asm_optimisation=$asm_opt
130 ;;
131 esac
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000132 ;;
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100133 i*86)
134 cpu_ia32=true
135 AC_DEFINE(FLAC__CPU_IA32)
136 AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000137 asm_optimisation=$asm_opt
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100138 ;;
Erik de Castro Lopo592021e2012-12-28 09:49:50 +1100139 powerpc|powerpc64)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100140 cpu_ppc=true
141 AC_DEFINE(FLAC__CPU_PPC)
142 AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC])
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000143 asm_optimisation=$asm_opt
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100144 ;;
145 sparc)
146 cpu_sparc=true
147 AC_DEFINE(FLAC__CPU_SPARC)
148 AH_TEMPLATE(FLAC__CPU_SPARC, [define if building for SPARC])
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000149 asm_optimisation=$asm_opt
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100150 ;;
151esac
Erik de Castro Lopob8d58e32014-06-15 20:29:34 +1000152AM_CONDITIONAL(FLAC__CPU_X86_64, test "x$cpu_x86_64" = xtrue)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100153AM_CONDITIONAL(FLaC__CPU_IA32, test "x$cpu_ia32" = xtrue)
154AM_CONDITIONAL(FLaC__CPU_PPC, test "x$cpu_ppc" = xtrue)
155AM_CONDITIONAL(FLaC__CPU_SPARC, test "x$cpu_sparc" = xtrue)
156
Erik de Castro Lopo336f6a52015-02-25 06:40:53 +1100157if test "x$ac_cv_header_x86intrin_h" = xyes; then
158AC_DEFINE([FLAC__HAS_X86INTRIN], 1, [Set to 1 if <x86intrin.h> is available.])
159fi
Erik de Castro Lopob72540b2013-09-15 09:42:29 +1000160
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100161case "$host" in
162 i386-*-openbsd3.[[0-3]]) OBJ_FORMAT=aoutb ;;
163 *-*-cygwin|*mingw*) OBJ_FORMAT=win32 ;;
164 *-*-darwin*) OBJ_FORMAT=macho ;;
Erik de Castro Lopo0fe97672012-02-05 16:29:43 +1100165 *emx*) OBJ_FORMAT=aout ;;
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100166 *) OBJ_FORMAT=elf ;;
167esac
168AC_SUBST(OBJ_FORMAT)
Erik de Castro Lopob6e64af2012-02-13 19:46:32 +1100169case "$host" in
170 *-gnuspe)
171 abi_spe=true
172 AC_DEFINE(FLAC__CPU_PPC_SPE)
173 AH_TEMPLATE(FLAC__CPU_PPC_SPE, [define if building for PowerPC with SPE ABI])
174 ;;
175esac
176AM_CONDITIONAL(FLaC__CPU_PPC_SPE, test "x$abi_spe" = xtrue)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100177
Erik de Castro Lopo2199d082013-04-01 19:57:13 +1100178os_is_windows=no
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100179case "$host" in
Erik de Castro Lopoc1ebd2c2013-04-29 21:32:48 +1000180 *-*-cygwin|*mingw*)
Erik de Castro Lopof44c3532013-04-02 06:27:07 +1100181 CPPFLAGS="-D__MSVCRT_VERSION__=0x0601 $CPPFLAGS"
Erik de Castro Lopo2199d082013-04-01 19:57:13 +1100182 os_is_windows=yes
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100183 ;;
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100184esac
Cristian Rodríguez355f4aa2013-07-21 01:28:51 -0400185
Erik de Castro Lopo2199d082013-04-01 19:57:13 +1100186AM_CONDITIONAL(OS_IS_WINDOWS, test "x$os_is_windows" = xyes)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100187
188case "$host" in
189 *-pc-linux-gnu)
190 sys_linux=true
191 AC_DEFINE(FLAC__SYS_LINUX)
192 AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux])
193 ;;
194 *-*-darwin*)
195 sys_darwin=true
196 AC_DEFINE(FLAC__SYS_DARWIN)
197 AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X])
198 ;;
199esac
200AM_CONDITIONAL(FLaC__SYS_DARWIN, test "x$sys_darwin" = xtrue)
201AM_CONDITIONAL(FLaC__SYS_LINUX, test "x$sys_linux" = xtrue)
202
Erik de Castro Lopo899599e2013-09-25 23:26:49 +1000203if test "x$cpu_ia32" = xtrue || test "x$cpu_x86_64" = xtrue ; then
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100204AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
205AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA, [define to align allocated memory on 32-byte boundaries])
206fi
207
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100208AC_ARG_ENABLE(debug,
209AC_HELP_STRING([--enable-debug], [Turn on debugging]),
210[case "${enableval}" in
211 yes) debug=true ;;
212 no) debug=false ;;
213 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
214esac],[debug=false])
215AM_CONDITIONAL(DEBUG, test "x$debug" = xtrue)
216
217AC_ARG_ENABLE(sse,
Erik de Castro Lopo98639982014-03-15 16:47:49 +1100218AC_HELP_STRING([--disable-sse], [Disable SSE if the OS does not support SSE instructions]),
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100219[case "${enableval}" in
Erik de Castro Lopo98639982014-03-15 16:47:49 +1100220 yes) sse_os=yes ;;
221 no) sse_os=no ;;
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100222 *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
Erik de Castro Lopo98639982014-03-15 16:47:49 +1100223esac],[sse_os=yes])
Erik de Castro Lopo336f6a52015-02-25 06:40:53 +1100224AM_CONDITIONAL(FLaC__SSE_OS, test "x$sse_os" = xyes)
Erik de Castro Lopo98639982014-03-15 16:47:49 +1100225if test "x$sse_os" = xyes ; then
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100226AC_DEFINE(FLAC__SSE_OS)
227AH_TEMPLATE(FLAC__SSE_OS, [define if your operating system supports SSE instructions])
228fi
229
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100230AC_ARG_ENABLE(altivec,
231AC_HELP_STRING([--disable-altivec], [Disable Altivec optimizations]),
232[case "${enableval}" in
233 yes) use_altivec=true ;;
234 no) use_altivec=false ;;
235 *) AC_MSG_ERROR(bad value ${enableval} for --enable-altivec) ;;
236esac],[use_altivec=true])
237AM_CONDITIONAL(FLaC__USE_ALTIVEC, test "x$use_altivec" = xtrue)
238if test "x$use_altivec" = xtrue ; then
239AC_DEFINE(FLAC__USE_ALTIVEC)
240AH_TEMPLATE(FLAC__USE_ALTIVEC, [define to enable use of Altivec instructions])
241fi
242
243AC_ARG_ENABLE(thorough-tests,
244AC_HELP_STRING([--disable-thorough-tests], [Disable thorough (long) testing, do only basic tests]),
245[case "${enableval}" in
246 yes) thorough_tests=true ;;
247 no) thorough_tests=false ;;
248 *) AC_MSG_ERROR(bad value ${enableval} for --enable-thorough-tests) ;;
249esac],[thorough_tests=true])
250AC_ARG_ENABLE(exhaustive-tests,
251AC_HELP_STRING([--enable-exhaustive-tests], [Enable exhaustive testing (VERY long)]),
252[case "${enableval}" in
253 yes) exhaustive_tests=true ;;
254 no) exhaustive_tests=false ;;
255 *) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
256esac],[exhaustive_tests=false])
257if test "x$thorough_tests" = xfalse ; then
258FLAC__TEST_LEVEL=0
259elif test "x$exhaustive_tests" = xfalse ; then
260FLAC__TEST_LEVEL=1
261else
262FLAC__TEST_LEVEL=2
263fi
264AC_SUBST(FLAC__TEST_LEVEL)
265
Erik de Castro Lopo2c455372014-04-08 20:48:13 +1000266AC_ARG_ENABLE(werror,
267 AC_HELP_STRING([--enable-werror], [Enable -Werror in all Makefiles]))
Erik de Castro Lopo195470f2013-03-13 18:58:16 +1100268
269AC_ARG_ENABLE(stack-smash-protection,
270 AC_HELP_STRING([--enable-stack-smash-protection], [Enable GNU GCC stack smash protection]))
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100271
Erik de Castro Lopoa3224c02016-01-04 11:29:03 +1100272AC_ARG_ENABLE(64-bit-words,
273 AC_HELP_STRING([--enable-64-bit-words], [Set FLAC__BYTES_PER_WORD to 8 (4 is the default)]))
274if test "x$enable_64_bit_words" = xyes ; then
275 AC_DEFINE_UNQUOTED([ENABLE_64_BIT_WORDS],1,[Set FLAC__BYTES_PER_WORD to 8 (4 is the default)])
276else
277 AC_DEFINE_UNQUOTED([ENABLE_64_BIT_WORDS],0)
278 fi
279AC_SUBST(ENABLE_64_BIT_WORDS)
280
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100281AC_ARG_ENABLE(valgrind-testing,
282AC_HELP_STRING([--enable-valgrind-testing], [Run all tests inside Valgrind]),
283[case "${enableval}" in
284 yes) FLAC__TEST_WITH_VALGRIND=yes ;;
285 no) FLAC__TEST_WITH_VALGRIND=no ;;
286 *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind-testing) ;;
287esac],[FLAC__TEST_WITH_VALGRIND=no])
288AC_SUBST(FLAC__TEST_WITH_VALGRIND)
289
290AC_ARG_ENABLE(doxygen-docs,
291AC_HELP_STRING([--disable-doxygen-docs], [Disable API documentation building via Doxygen]),
292[case "${enableval}" in
293 yes) enable_doxygen_docs=true ;;
294 no) enable_doxygen_docs=false ;;
295 *) AC_MSG_ERROR(bad value ${enableval} for --enable-doxygen-docs) ;;
296esac],[enable_doxygen_docs=true])
297if test "x$enable_doxygen_docs" != xfalse ; then
298 AC_CHECK_PROGS(DOXYGEN, doxygen)
299fi
300AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
301
302AC_ARG_ENABLE(local-xmms-plugin,
303AC_HELP_STRING([--enable-local-xmms-plugin], [Install XMMS plugin to ~/.xmms/Plugins instead of system location]),
304[case "${enableval}" in
305 yes) install_xmms_plugin_locally=true ;;
306 no) install_xmms_plugin_locally=false ;;
307 *) AC_MSG_ERROR(bad value ${enableval} for --enable-local-xmms-plugin) ;;
308esac],[install_xmms_plugin_locally=false])
309AM_CONDITIONAL(FLaC__INSTALL_XMMS_PLUGIN_LOCALLY, test "x$install_xmms_plugin_locally" = xtrue)
310
311AC_ARG_ENABLE(xmms-plugin,
312AC_HELP_STRING([--disable-xmms-plugin], [Do not build XMMS plugin]),
313[case "${enableval}" in
314 yes) enable_xmms_plugin=true ;;
315 no) enable_xmms_plugin=false ;;
316 *) AC_MSG_ERROR(bad value ${enableval} for --enable-xmms-plugin) ;;
317esac],[enable_xmms_plugin=true])
318if test "x$enable_xmms_plugin" != xfalse ; then
319 AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - XMMS support will not be built]))
320fi
321AM_CONDITIONAL(FLaC__HAS_XMMS, test -n "$XMMS_INPUT_PLUGIN_DIR")
322
323dnl build FLAC++ or not
324AC_ARG_ENABLE([cpplibs],
325AC_HELP_STRING([--disable-cpplibs], [Do not build libFLAC++]),
326[case "${enableval}" in
327 yes) disable_cpplibs=false ;;
328 no) disable_cpplibs=true ;;
329 *) AC_MSG_ERROR(bad value ${enableval} for --enable-cpplibs) ;;
330esac], [disable_cpplibs=false])
331AM_CONDITIONAL(FLaC__WITH_CPPLIBS, [test "x$disable_cpplibs" != xtrue])
332
333dnl check for ogg library
334AC_ARG_ENABLE([ogg],
335 AC_HELP_STRING([--disable-ogg], [Disable ogg support (default: test for libogg)]),
336 [ want_ogg=$enableval ], [ want_ogg=yes ] )
337
338if test "x$want_ogg" != "xno"; then
339 XIPH_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development enviroment not installed - Ogg support will not be built]))
340fi
341
342AM_CONDITIONAL(FLaC__HAS_OGG, [test "x$have_ogg" = xyes])
343if test "x$have_ogg" = xyes ; then
Erik de Castro Lopo3e2cd272012-07-04 19:53:31 +1000344 AC_DEFINE_UNQUOTED([FLAC__HAS_OGG],1,[define if you have the ogg library])
Ulrich Klauer5da86632013-04-06 20:41:12 +0200345 OGG_PACKAGE="ogg"
Erik de Castro Lopo3e2cd272012-07-04 19:53:31 +1000346else
347 AC_DEFINE_UNQUOTED([FLAC__HAS_OGG],0)
Erik de Castro Lopoe21237a2013-09-15 19:58:05 +1000348 have_ogg=no
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100349fi
Ulrich Klauer5da86632013-04-06 20:41:12 +0200350AC_SUBST(OGG_PACKAGE)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100351
352dnl check for i18n(internationalization); these are from libiconv/gettext
353AM_ICONV
354AM_LANGINFO_CODESET
355
356AC_CHECK_PROGS(DOCBOOK_TO_MAN, docbook-to-man docbook2man)
357AM_CONDITIONAL(FLaC__HAS_DOCBOOK_TO_MAN, test -n "$DOCBOOK_TO_MAN")
358if test -n "$DOCBOOK_TO_MAN" ; then
359AC_DEFINE(FLAC__HAS_DOCBOOK_TO_MAN)
360AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN, [define if you have docbook-to-man or docbook2man])
361fi
362
363# only matters for x86
364AC_CHECK_PROGS(NASM, nasm)
365AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
366if test -n "$NASM" ; then
367AC_DEFINE(FLAC__HAS_NASM)
368AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler])
369fi
370
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100371if test "x$debug" = xtrue; then
Cristian Rodríguez9b7cb222012-04-07 19:24:21 -0300372 CPPFLAGS="-DDEBUG $CPPFLAGS"
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100373 CFLAGS="-g $CFLAGS"
374else
375 CPPFLAGS="-DNDEBUG $CPPFLAGS"
Erik de Castro Lopo1e4ffab2014-11-30 11:56:47 +1100376 CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//')
Erik de Castro Lopof73c82a2014-07-27 10:08:44 +1000377 CFLAGS="-O3 -funroll-loops $CFLAGS"
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100378fi
379
Erik de Castro Lopocaef93e2012-02-26 22:41:44 +1100380XIPH_GCC_VERSION
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100381
382if test x$ac_cv_c_compiler_gnu = xyes ; then
Erik de Castro Lopof73c82a2014-07-27 10:08:44 +1000383 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
Erik de Castro Lopobc2b8c62014-03-21 18:52:24 +1100384 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
Erik de Castro Lopo06f38122013-03-10 22:34:18 +1100385
Erik de Castro Lopo24a64472013-09-15 18:09:48 +1000386 XIPH_ADD_CFLAGS([-Wdeclaration-after-statement])
387 XIPH_ADD_CFLAGS([-D_FORTIFY_SOURCE=2])
388
389 AC_LANG_PUSH([C++])
390 XIPH_ADD_CXXFLAGS([-Weffc++])
391 AC_LANG_POP([C++])
392
Miroslav Lichvar19c78e52012-12-03 21:04:57 +0100393 if test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = elf; then
394 CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
395 CFLAGS="$CFLAGS -fvisibility=hidden"
396 CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
Erik de Castro Lopo2860f172013-03-09 19:42:26 +1100397 fi
398
Erik de Castro Lopobe0a8942014-05-25 19:42:53 +1000399 if test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = macho; then
400 CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
401 CFLAGS="$CFLAGS -fvisibility=hidden"
402 CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
403 fi
404
Erik de Castro Lopo2860f172013-03-09 19:42:26 +1100405 if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x42" ; then
406 XIPH_ADD_CFLAGS([-fgnu89-inline])
407 fi
Erik de Castro Lopo24a64472013-09-15 18:09:48 +1000408
Mario Sanchez Prada5ff15bd2015-06-08 17:25:27 +0100409 if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x47" ; then
410 XIPH_ADD_CFLAGS([-fno-inline-small-functions])
411 fi
412
Erik de Castro Lopo1930ae12014-07-27 21:18:08 +1000413 if test "x$asm_optimisation$sse_os" = "xyesyes" ; then
Erik de Castro Lopoae4d7202013-09-15 20:34:40 +1000414 XIPH_ADD_CFLAGS([-msse2])
415 fi
416
Miroslav Lichvar19c78e52012-12-03 21:04:57 +0100417 fi
Miroslav Lichvar19c78e52012-12-03 21:04:57 +0100418
Tristan Matthewsa8458702015-04-11 01:05:30 -0400419case "$host_os" in
420 "mingw32"|"os2")
421 if test "$host_cpu" = "i686"; then
422 XIPH_ADD_CFLAGS([-mstackrealign])
423 fi
424 esac
425
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 Lopo2c455372014-04-08 20:48:13 +1000428if test x$enable_werror = "xyes" ; then
429 XIPH_ADD_CFLAGS([-Werror])
430 AC_LANG_PUSH([C++])
431 XIPH_ADD_CXXFLAGS([-Werror])
432 AC_LANG_POP([C++])
433 fi
434
Erik de Castro Lopo195470f2013-03-13 18:58:16 +1100435if test x$enable_stack_smash_protection = "xyes" ; then
436 XIPH_GCC_STACK_PROTECTOR
437 XIPH_GXX_STACK_PROTECTOR
438 fi
Erik de Castro Lopod5b03bc2013-03-09 08:55:37 +1100439
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100440AC_CONFIG_FILES([ \
441 Makefile \
442 src/Makefile \
443 src/libFLAC/Makefile \
444 src/libFLAC/flac.pc \
445 src/libFLAC/ia32/Makefile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100446 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 \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100453 src/plugin_common/Makefile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100454 src/plugin_xmms/Makefile \
455 src/share/Makefile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100456 src/test_grabbag/Makefile \
457 src/test_grabbag/cuesheet/Makefile \
458 src/test_grabbag/picture/Makefile \
459 src/test_libs_common/Makefile \
460 src/test_libFLAC/Makefile \
461 src/test_libFLAC++/Makefile \
462 src/test_seeking/Makefile \
463 src/test_streams/Makefile \
464 src/utils/Makefile \
465 src/utils/flacdiff/Makefile \
466 src/utils/flactimer/Makefile \
467 examples/Makefile \
468 examples/c/Makefile \
469 examples/c/decode/Makefile \
470 examples/c/decode/file/Makefile \
471 examples/c/encode/Makefile \
472 examples/c/encode/file/Makefile \
473 examples/cpp/Makefile \
474 examples/cpp/decode/Makefile \
475 examples/cpp/decode/file/Makefile \
476 examples/cpp/encode/Makefile \
477 examples/cpp/encode/file/Makefile \
478 include/Makefile \
479 include/FLAC/Makefile \
480 include/FLAC++/Makefile \
481 include/share/Makefile \
482 include/share/grabbag/Makefile \
483 include/test_libs_common/Makefile \
Olivier Blinf6997882012-12-28 19:58:46 +0100484 doc/Doxyfile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100485 doc/Makefile \
486 doc/html/Makefile \
487 doc/html/images/Makefile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100488 m4/Makefile \
489 man/Makefile \
Erik de Castro Lopoa9712a22013-09-16 19:55:11 +1000490 test/common.sh \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100491 test/Makefile \
492 test/cuesheets/Makefile \
493 test/flac-to-flac-metadata-test-files/Makefile \
494 test/metaflac-test-files/Makefile \
495 test/pictures/Makefile \
496 build/Makefile \
Erik de Castro Lopo55788ea2012-12-28 11:06:38 +1100497 objs/Makefile \
498 objs/debug/Makefile \
499 objs/debug/bin/Makefile \
500 objs/debug/lib/Makefile \
501 objs/release/Makefile \
502 objs/release/bin/Makefile \
503 objs/release/lib/Makefile \
Erik de Castro Lopo95fc3bf2015-09-01 03:38:43 +1000504 microbench/Makefile
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100505])
506AC_OUTPUT
Erik de Castro Lopocaef93e2012-02-26 22:41:44 +1100507
508AC_MSG_RESULT([
509-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
510
511 Configuration summary :
512
513 FLAC version : ........................ ${VERSION}
514
515 Host CPU : ............................ ${host_cpu}
516 Host Vendor : ......................... ${host_vendor}
517 Host OS : ............................. ${host_os}
518])
519
Erik de Castro Lopocaef93e2012-02-26 22:41:44 +1100520 echo " Compiler is GCC : ..................... ${ac_cv_c_compiler_gnu}"
Max Horncdcb88b2012-12-12 21:33:53 +0100521if test x$ac_cv_c_compiler_gnu = xyes ; then
Erik de Castro Lopocaef93e2012-02-26 22:41:44 +1100522 echo " GCC version : ......................... ${GCC_VERSION}"
Max Horncdcb88b2012-12-12 21:33:53 +0100523fi
Erik de Castro Lopoa6a4b6f2013-11-22 18:13:36 +1100524 echo " Compiler is Clang : ................... ${xiph_cv_c_compiler_clang}"
Erik de Castro Lopo98639982014-03-15 16:47:49 +1100525 echo " SSE optimizations : ................... ${sse_os}"
Erik de Castro Lopo899599e2013-09-25 23:26:49 +1000526 echo " Asm optimizations : ................... ${asm_optimisation}"
Erik de Castro Lopoe21237a2013-09-15 19:58:05 +1000527 echo " Ogg/FLAC support : .................... ${have_ogg}"
Erik de Castro Lopo592021e2012-12-28 09:49:50 +1100528echo