blob: a3e0fadb2acb6f10c20d87d43a0f169e7d52c179 [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 Lopoac39d372017-01-01 11:54:07 +110022AC_INIT([flac], [1.3.2], [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 Lopo74117242016-01-26 13:35:10 +110065AC_CHECK_HEADERS([stdint.h inttypes.h byteswap.h sys/param.h sys/ioctl.h termios.h x86intrin.h cpuid.h])
Cristian Rodríguezf0296252012-04-05 19:39:37 -030066
Erik de Castro Lopod7bfc772012-02-06 07:15:48 +110067XIPH_C_BSWAP32
Ralph Giles7a671e72014-11-04 11:58:45 -080068XIPH_C_BSWAP16
Erik de Castro Lopod7bfc772012-02-06 07:15:48 +110069
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
Christian Weisgerberb5a10e72015-01-09 22:37:37 +0000105 amd64|x86_64)
Erik de Castro Lopo7566d3d2015-03-11 20:51:42 +1100106 case "$host" in
107 *gnux32)
108 # x32 user space and 64 bit kernel.
109 cpu_x86_64=true
110 AC_DEFINE(FLAC__CPU_X86_64)
111 AH_TEMPLATE(FLAC__CPU_X86_64, [define if building for x86_64])
112 asm_optimisation=$asm_opt
113 ;;
114 *)
115 if test $ac_cv_sizeof_voidp = 4 ; then
116 # This must be a 32 bit user space running on 64 bit kernel so treat
117 # this as ia32.
118 cpu_ia32=true
119 AC_DEFINE(FLAC__CPU_IA32)
120 AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
121 else
122 # x86_64 user space and kernel.
123 cpu_x86_64=true
124 AC_DEFINE(FLAC__CPU_X86_64)
125 AH_TEMPLATE(FLAC__CPU_X86_64, [define if building for x86_64])
126 fi
127 asm_optimisation=$asm_opt
128 ;;
129 esac
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000130 ;;
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100131 i*86)
132 cpu_ia32=true
133 AC_DEFINE(FLAC__CPU_IA32)
134 AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000135 asm_optimisation=$asm_opt
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100136 ;;
Erik de Castro Lopo592021e2012-12-28 09:49:50 +1100137 powerpc|powerpc64)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100138 cpu_ppc=true
139 AC_DEFINE(FLAC__CPU_PPC)
140 AH_TEMPLATE(FLAC__CPU_PPC, [define if building for PowerPC])
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000141 asm_optimisation=$asm_opt
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100142 ;;
143 sparc)
144 cpu_sparc=true
145 AC_DEFINE(FLAC__CPU_SPARC)
146 AH_TEMPLATE(FLAC__CPU_SPARC, [define if building for SPARC])
Erik de Castro Lopo1ec41a92013-08-11 21:46:18 +1000147 asm_optimisation=$asm_opt
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100148 ;;
149esac
Erik de Castro Lopob8d58e32014-06-15 20:29:34 +1000150AM_CONDITIONAL(FLAC__CPU_X86_64, test "x$cpu_x86_64" = xtrue)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100151AM_CONDITIONAL(FLaC__CPU_IA32, test "x$cpu_ia32" = xtrue)
152AM_CONDITIONAL(FLaC__CPU_PPC, test "x$cpu_ppc" = xtrue)
153AM_CONDITIONAL(FLaC__CPU_SPARC, test "x$cpu_sparc" = xtrue)
154
Erik de Castro Lopo336f6a52015-02-25 06:40:53 +1100155if test "x$ac_cv_header_x86intrin_h" = xyes; then
156AC_DEFINE([FLAC__HAS_X86INTRIN], 1, [Set to 1 if <x86intrin.h> is available.])
Erik de Castro Lopo36a0ab12016-06-20 20:29:59 +1000157else
158AC_DEFINE([FLAC__HAS_X86INTRIN], 0)
Erik de Castro Lopo336f6a52015-02-25 06:40:53 +1100159fi
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 ;;
sezero31b219f2017-01-13 17:51:06 +0300166 *djgpp) OBJ_FORMAT=coff ;;
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100167 *) OBJ_FORMAT=elf ;;
168esac
169AC_SUBST(OBJ_FORMAT)
Erik de Castro Lopob6e64af2012-02-13 19:46:32 +1100170case "$host" in
171 *-gnuspe)
172 abi_spe=true
173 AC_DEFINE(FLAC__CPU_PPC_SPE)
174 AH_TEMPLATE(FLAC__CPU_PPC_SPE, [define if building for PowerPC with SPE ABI])
175 ;;
176esac
177AM_CONDITIONAL(FLaC__CPU_PPC_SPE, test "x$abi_spe" = xtrue)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100178
Erik de Castro Lopo2199d082013-04-01 19:57:13 +1100179os_is_windows=no
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100180case "$host" in
Erik de Castro Lopoc1ebd2c2013-04-29 21:32:48 +1000181 *-*-cygwin|*mingw*)
Erik de Castro Lopof44c3532013-04-02 06:27:07 +1100182 CPPFLAGS="-D__MSVCRT_VERSION__=0x0601 $CPPFLAGS"
Erik de Castro Lopo2199d082013-04-01 19:57:13 +1100183 os_is_windows=yes
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100184 ;;
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100185esac
Cristian Rodríguez355f4aa2013-07-21 01:28:51 -0400186
Erik de Castro Lopo2199d082013-04-01 19:57:13 +1100187AM_CONDITIONAL(OS_IS_WINDOWS, test "x$os_is_windows" = xyes)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100188
189case "$host" in
Peter Korsgaard55721552017-01-09 22:19:01 +0100190 *-linux-*)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100191 sys_linux=true
192 AC_DEFINE(FLAC__SYS_LINUX)
193 AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux])
194 ;;
195 *-*-darwin*)
196 sys_darwin=true
197 AC_DEFINE(FLAC__SYS_DARWIN)
198 AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X])
199 ;;
200esac
201AM_CONDITIONAL(FLaC__SYS_DARWIN, test "x$sys_darwin" = xtrue)
202AM_CONDITIONAL(FLaC__SYS_LINUX, test "x$sys_linux" = xtrue)
203
Erik de Castro Lopo899599e2013-09-25 23:26:49 +1000204if test "x$cpu_ia32" = xtrue || test "x$cpu_x86_64" = xtrue ; then
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100205AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
206AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA, [define to align allocated memory on 32-byte boundaries])
207fi
208
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100209AC_ARG_ENABLE(debug,
210AC_HELP_STRING([--enable-debug], [Turn on debugging]),
211[case "${enableval}" in
212 yes) debug=true ;;
213 no) debug=false ;;
214 *) AC_MSG_ERROR(bad value ${enableval} for --enable-debug) ;;
215esac],[debug=false])
216AM_CONDITIONAL(DEBUG, test "x$debug" = xtrue)
217
218AC_ARG_ENABLE(sse,
Erik de Castro Lopof39a0ea2016-12-05 05:37:44 +1100219AC_HELP_STRING([--disable-sse], [Disable passing of -msse2 to the compiler]),
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100220[case "${enableval}" in
Erik de Castro Lopo98639982014-03-15 16:47:49 +1100221 yes) sse_os=yes ;;
222 no) sse_os=no ;;
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100223 *) AC_MSG_ERROR(bad value ${enableval} for --enable-sse) ;;
Erik de Castro Lopo98639982014-03-15 16:47:49 +1100224esac],[sse_os=yes])
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100225
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100226AC_ARG_ENABLE(altivec,
227AC_HELP_STRING([--disable-altivec], [Disable Altivec optimizations]),
228[case "${enableval}" in
229 yes) use_altivec=true ;;
230 no) use_altivec=false ;;
231 *) AC_MSG_ERROR(bad value ${enableval} for --enable-altivec) ;;
232esac],[use_altivec=true])
233AM_CONDITIONAL(FLaC__USE_ALTIVEC, test "x$use_altivec" = xtrue)
234if test "x$use_altivec" = xtrue ; then
235AC_DEFINE(FLAC__USE_ALTIVEC)
236AH_TEMPLATE(FLAC__USE_ALTIVEC, [define to enable use of Altivec instructions])
237fi
238
Dave Yeo0435a232016-01-24 22:09:50 -0800239AC_ARG_ENABLE(avx,
240AC_HELP_STRING([--disable-avx], [Disable AVX, AVX2 optimizations]),
241[case "${enableval}" in
242 yes) use_avx=true ;;
243 no) use_avx=false ;;
244 *) AC_MSG_ERROR(bad value ${enableval} for --enable-avx) ;;
245esac],[use_avx=true])
246AM_CONDITIONAL(FLaC__USE_AVX, test "x$use_avx" = xtrue)
247if test "x$use_avx" = xtrue ; then
248AC_DEFINE(FLAC__USE_AVX)
249AH_TEMPLATE(FLAC__USE_AVX, [define to enable use of AVX instructions])
250fi
251
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100252AC_ARG_ENABLE(thorough-tests,
253AC_HELP_STRING([--disable-thorough-tests], [Disable thorough (long) testing, do only basic tests]),
254[case "${enableval}" in
255 yes) thorough_tests=true ;;
256 no) thorough_tests=false ;;
257 *) AC_MSG_ERROR(bad value ${enableval} for --enable-thorough-tests) ;;
258esac],[thorough_tests=true])
259AC_ARG_ENABLE(exhaustive-tests,
260AC_HELP_STRING([--enable-exhaustive-tests], [Enable exhaustive testing (VERY long)]),
261[case "${enableval}" in
262 yes) exhaustive_tests=true ;;
263 no) exhaustive_tests=false ;;
264 *) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
265esac],[exhaustive_tests=false])
266if test "x$thorough_tests" = xfalse ; then
267FLAC__TEST_LEVEL=0
268elif test "x$exhaustive_tests" = xfalse ; then
269FLAC__TEST_LEVEL=1
270else
271FLAC__TEST_LEVEL=2
272fi
273AC_SUBST(FLAC__TEST_LEVEL)
274
Erik de Castro Lopo2c455372014-04-08 20:48:13 +1000275AC_ARG_ENABLE(werror,
276 AC_HELP_STRING([--enable-werror], [Enable -Werror in all Makefiles]))
Erik de Castro Lopo195470f2013-03-13 18:58:16 +1100277
278AC_ARG_ENABLE(stack-smash-protection,
279 AC_HELP_STRING([--enable-stack-smash-protection], [Enable GNU GCC stack smash protection]))
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100280
Erik de Castro Lopoa3224c02016-01-04 11:29:03 +1100281AC_ARG_ENABLE(64-bit-words,
282 AC_HELP_STRING([--enable-64-bit-words], [Set FLAC__BYTES_PER_WORD to 8 (4 is the default)]))
283if test "x$enable_64_bit_words" = xyes ; then
284 AC_DEFINE_UNQUOTED([ENABLE_64_BIT_WORDS],1,[Set FLAC__BYTES_PER_WORD to 8 (4 is the default)])
285else
286 AC_DEFINE_UNQUOTED([ENABLE_64_BIT_WORDS],0)
287 fi
288AC_SUBST(ENABLE_64_BIT_WORDS)
289
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100290AC_ARG_ENABLE(valgrind-testing,
291AC_HELP_STRING([--enable-valgrind-testing], [Run all tests inside Valgrind]),
292[case "${enableval}" in
293 yes) FLAC__TEST_WITH_VALGRIND=yes ;;
294 no) FLAC__TEST_WITH_VALGRIND=no ;;
295 *) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind-testing) ;;
296esac],[FLAC__TEST_WITH_VALGRIND=no])
297AC_SUBST(FLAC__TEST_WITH_VALGRIND)
298
299AC_ARG_ENABLE(doxygen-docs,
300AC_HELP_STRING([--disable-doxygen-docs], [Disable API documentation building via Doxygen]),
301[case "${enableval}" in
302 yes) enable_doxygen_docs=true ;;
303 no) enable_doxygen_docs=false ;;
304 *) AC_MSG_ERROR(bad value ${enableval} for --enable-doxygen-docs) ;;
305esac],[enable_doxygen_docs=true])
306if test "x$enable_doxygen_docs" != xfalse ; then
307 AC_CHECK_PROGS(DOXYGEN, doxygen)
308fi
309AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
310
311AC_ARG_ENABLE(local-xmms-plugin,
312AC_HELP_STRING([--enable-local-xmms-plugin], [Install XMMS plugin to ~/.xmms/Plugins instead of system location]),
313[case "${enableval}" in
314 yes) install_xmms_plugin_locally=true ;;
315 no) install_xmms_plugin_locally=false ;;
316 *) AC_MSG_ERROR(bad value ${enableval} for --enable-local-xmms-plugin) ;;
317esac],[install_xmms_plugin_locally=false])
318AM_CONDITIONAL(FLaC__INSTALL_XMMS_PLUGIN_LOCALLY, test "x$install_xmms_plugin_locally" = xtrue)
319
320AC_ARG_ENABLE(xmms-plugin,
321AC_HELP_STRING([--disable-xmms-plugin], [Do not build XMMS plugin]),
322[case "${enableval}" in
323 yes) enable_xmms_plugin=true ;;
324 no) enable_xmms_plugin=false ;;
325 *) AC_MSG_ERROR(bad value ${enableval} for --enable-xmms-plugin) ;;
326esac],[enable_xmms_plugin=true])
327if test "x$enable_xmms_plugin" != xfalse ; then
328 AM_PATH_XMMS(0.9.5.1, , AC_MSG_WARN([*** XMMS >= 0.9.5.1 not installed - XMMS support will not be built]))
329fi
330AM_CONDITIONAL(FLaC__HAS_XMMS, test -n "$XMMS_INPUT_PLUGIN_DIR")
331
332dnl build FLAC++ or not
333AC_ARG_ENABLE([cpplibs],
334AC_HELP_STRING([--disable-cpplibs], [Do not build libFLAC++]),
335[case "${enableval}" in
336 yes) disable_cpplibs=false ;;
337 no) disable_cpplibs=true ;;
338 *) AC_MSG_ERROR(bad value ${enableval} for --enable-cpplibs) ;;
339esac], [disable_cpplibs=false])
340AM_CONDITIONAL(FLaC__WITH_CPPLIBS, [test "x$disable_cpplibs" != xtrue])
341
342dnl check for ogg library
343AC_ARG_ENABLE([ogg],
344 AC_HELP_STRING([--disable-ogg], [Disable ogg support (default: test for libogg)]),
345 [ want_ogg=$enableval ], [ want_ogg=yes ] )
346
347if test "x$want_ogg" != "xno"; then
348 XIPH_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development enviroment not installed - Ogg support will not be built]))
349fi
350
Erik de Castro Lopo9548d4b2016-03-20 20:14:01 +1100351FLAC__HAS_OGG=0
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100352AM_CONDITIONAL(FLaC__HAS_OGG, [test "x$have_ogg" = xyes])
353if test "x$have_ogg" = xyes ; then
Erik de Castro Lopo9548d4b2016-03-20 20:14:01 +1100354 FLAC__HAS_OGG=1
Ulrich Klauer5da86632013-04-06 20:41:12 +0200355 OGG_PACKAGE="ogg"
Erik de Castro Lopo3e2cd272012-07-04 19:53:31 +1000356else
Erik de Castro Lopoe21237a2013-09-15 19:58:05 +1000357 have_ogg=no
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100358fi
Erik de Castro Lopo9548d4b2016-03-20 20:14:01 +1100359AC_DEFINE_UNQUOTED([FLAC__HAS_OGG],$FLAC__HAS_OGG,[define if you have the ogg library])
360AC_SUBST(FLAC__HAS_OGG)
Ulrich Klauer5da86632013-04-06 20:41:12 +0200361AC_SUBST(OGG_PACKAGE)
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100362
David Seifertcc08beb2017-01-13 18:42:29 +0100363dnl Build examples?
364AC_ARG_ENABLE([examples],
365 AS_HELP_STRING([--disable-examples], [Don't build and install examples]))
366AM_CONDITIONAL([EXAMPLES], [test "x$enable_examples" != "xno"])
367
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100368dnl check for i18n(internationalization); these are from libiconv/gettext
369AM_ICONV
370AM_LANGINFO_CODESET
371
372AC_CHECK_PROGS(DOCBOOK_TO_MAN, docbook-to-man docbook2man)
373AM_CONDITIONAL(FLaC__HAS_DOCBOOK_TO_MAN, test -n "$DOCBOOK_TO_MAN")
374if test -n "$DOCBOOK_TO_MAN" ; then
375AC_DEFINE(FLAC__HAS_DOCBOOK_TO_MAN)
376AH_TEMPLATE(FLAC__HAS_DOCBOOK_TO_MAN, [define if you have docbook-to-man or docbook2man])
377fi
378
Dave Yeo50e7aea2016-02-02 20:19:59 -0800379AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
380if test x$have_clock_gettime = xyes; then
381 AC_DEFINE(HAVE_CLOCK_GETTIME)
Erik de Castro Lopo9cf42fe2016-02-10 21:24:41 +1100382 AH_TEMPLATE(HAVE_CLOCK_GETTIME, [define if you have clock_gettime])
Dave Yeo50e7aea2016-02-02 20:19:59 -0800383fi
384
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100385# only matters for x86
386AC_CHECK_PROGS(NASM, nasm)
387AM_CONDITIONAL(FLaC__HAS_NASM, test -n "$NASM")
388if test -n "$NASM" ; then
389AC_DEFINE(FLAC__HAS_NASM)
390AH_TEMPLATE(FLAC__HAS_NASM, [define if you are compiling for x86 and have the NASM assembler])
391fi
392
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100393if test "x$debug" = xtrue; then
Cristian Rodríguez9b7cb222012-04-07 19:24:21 -0300394 CPPFLAGS="-DDEBUG $CPPFLAGS"
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100395 CFLAGS="-g $CFLAGS"
396else
397 CPPFLAGS="-DNDEBUG $CPPFLAGS"
Erik de Castro Lopo1e4ffab2014-11-30 11:56:47 +1100398 CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//')
Erik de Castro Lopof73c82a2014-07-27 10:08:44 +1000399 CFLAGS="-O3 -funroll-loops $CFLAGS"
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100400fi
401
Erik de Castro Lopocaef93e2012-02-26 22:41:44 +1100402XIPH_GCC_VERSION
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100403
404if test x$ac_cv_c_compiler_gnu = xyes ; then
Erik de Castro Lopod6c774c2016-01-26 12:33:01 +1100405 CFLAGS="$CFLAGS -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Winline " # -Wcast-qual -Wbad-function-cast -Wwrite-strings -Wconversion
406 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 +1100407
Erik de Castro Lopo24a64472013-09-15 18:09:48 +1000408 XIPH_ADD_CFLAGS([-Wdeclaration-after-statement])
409 XIPH_ADD_CFLAGS([-D_FORTIFY_SOURCE=2])
410
411 AC_LANG_PUSH([C++])
412 XIPH_ADD_CXXFLAGS([-Weffc++])
413 AC_LANG_POP([C++])
414
Miroslav Lichvar19c78e52012-12-03 21:04:57 +0100415 if test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = elf; then
416 CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
417 CFLAGS="$CFLAGS -fvisibility=hidden"
418 CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
Erik de Castro Lopo2860f172013-03-09 19:42:26 +1100419 fi
420
Erik de Castro Lopobe0a8942014-05-25 19:42:53 +1000421 if test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = macho; then
422 CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
423 CFLAGS="$CFLAGS -fvisibility=hidden"
424 CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
425 fi
426
Erik de Castro Lopo2860f172013-03-09 19:42:26 +1100427 if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x42" ; then
428 XIPH_ADD_CFLAGS([-fgnu89-inline])
429 fi
Erik de Castro Lopo24a64472013-09-15 18:09:48 +1000430
Mario Sanchez Prada5ff15bd2015-06-08 17:25:27 +0100431 if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x47" ; then
432 XIPH_ADD_CFLAGS([-fno-inline-small-functions])
433 fi
434
Erik de Castro Lopo1930ae12014-07-27 21:18:08 +1000435 if test "x$asm_optimisation$sse_os" = "xyesyes" ; then
Erik de Castro Lopoae4d7202013-09-15 20:34:40 +1000436 XIPH_ADD_CFLAGS([-msse2])
437 fi
438
Miroslav Lichvar19c78e52012-12-03 21:04:57 +0100439 fi
Miroslav Lichvar19c78e52012-12-03 21:04:57 +0100440
Tristan Matthewsa8458702015-04-11 01:05:30 -0400441case "$host_os" in
442 "mingw32"|"os2")
443 if test "$host_cpu" = "i686"; then
444 XIPH_ADD_CFLAGS([-mstackrealign])
445 fi
446 esac
447
Erik de Castro Lopo2c455372014-04-08 20:48:13 +1000448if test x$enable_werror = "xyes" ; then
449 XIPH_ADD_CFLAGS([-Werror])
450 AC_LANG_PUSH([C++])
451 XIPH_ADD_CXXFLAGS([-Werror])
452 AC_LANG_POP([C++])
453 fi
454
Erik de Castro Lopo195470f2013-03-13 18:58:16 +1100455if test x$enable_stack_smash_protection = "xyes" ; then
456 XIPH_GCC_STACK_PROTECTOR
457 XIPH_GXX_STACK_PROTECTOR
458 fi
Erik de Castro Lopod5b03bc2013-03-09 08:55:37 +1100459
Erik de Castro Lopo924cade2016-01-24 08:21:23 +1100460if test "x$sys_linux" = xtrue ; then
461 LIB_CLOCK_GETTIME=-lrt
462 fi
463AC_SUBST(LIB_CLOCK_GETTIME)
464
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100465AC_CONFIG_FILES([ \
466 Makefile \
467 src/Makefile \
468 src/libFLAC/Makefile \
469 src/libFLAC/flac.pc \
470 src/libFLAC/ia32/Makefile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100471 src/libFLAC/include/Makefile \
472 src/libFLAC/include/private/Makefile \
473 src/libFLAC/include/protected/Makefile \
474 src/libFLAC++/Makefile \
475 src/libFLAC++/flac++.pc \
476 src/flac/Makefile \
477 src/metaflac/Makefile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100478 src/plugin_common/Makefile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100479 src/plugin_xmms/Makefile \
480 src/share/Makefile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100481 src/test_grabbag/Makefile \
482 src/test_grabbag/cuesheet/Makefile \
483 src/test_grabbag/picture/Makefile \
484 src/test_libs_common/Makefile \
485 src/test_libFLAC/Makefile \
486 src/test_libFLAC++/Makefile \
487 src/test_seeking/Makefile \
488 src/test_streams/Makefile \
489 src/utils/Makefile \
490 src/utils/flacdiff/Makefile \
491 src/utils/flactimer/Makefile \
492 examples/Makefile \
493 examples/c/Makefile \
494 examples/c/decode/Makefile \
495 examples/c/decode/file/Makefile \
496 examples/c/encode/Makefile \
497 examples/c/encode/file/Makefile \
498 examples/cpp/Makefile \
499 examples/cpp/decode/Makefile \
500 examples/cpp/decode/file/Makefile \
501 examples/cpp/encode/Makefile \
502 examples/cpp/encode/file/Makefile \
503 include/Makefile \
504 include/FLAC/Makefile \
505 include/FLAC++/Makefile \
506 include/share/Makefile \
507 include/share/grabbag/Makefile \
508 include/test_libs_common/Makefile \
Olivier Blinf6997882012-12-28 19:58:46 +0100509 doc/Doxyfile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100510 doc/Makefile \
511 doc/html/Makefile \
512 doc/html/images/Makefile \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100513 m4/Makefile \
514 man/Makefile \
Erik de Castro Lopoa9712a22013-09-16 19:55:11 +1000515 test/common.sh \
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100516 test/Makefile \
517 test/cuesheets/Makefile \
518 test/flac-to-flac-metadata-test-files/Makefile \
519 test/metaflac-test-files/Makefile \
520 test/pictures/Makefile \
521 build/Makefile \
Erik de Castro Lopo55788ea2012-12-28 11:06:38 +1100522 objs/Makefile \
523 objs/debug/Makefile \
524 objs/debug/bin/Makefile \
525 objs/debug/lib/Makefile \
526 objs/release/Makefile \
527 objs/release/bin/Makefile \
528 objs/release/lib/Makefile \
Erik de Castro Lopo95fc3bf2015-09-01 03:38:43 +1000529 microbench/Makefile
Erik de Castro Lopo06ed05e2012-02-01 17:55:50 +1100530])
531AC_OUTPUT
Erik de Castro Lopocaef93e2012-02-26 22:41:44 +1100532
533AC_MSG_RESULT([
534-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
535
536 Configuration summary :
537
538 FLAC version : ........................ ${VERSION}
539
540 Host CPU : ............................ ${host_cpu}
541 Host Vendor : ......................... ${host_vendor}
542 Host OS : ............................. ${host_os}
543])
544
Erik de Castro Lopocaef93e2012-02-26 22:41:44 +1100545 echo " Compiler is GCC : ..................... ${ac_cv_c_compiler_gnu}"
Max Horncdcb88b2012-12-12 21:33:53 +0100546if test x$ac_cv_c_compiler_gnu = xyes ; then
Erik de Castro Lopocaef93e2012-02-26 22:41:44 +1100547 echo " GCC version : ......................... ${GCC_VERSION}"
Max Horncdcb88b2012-12-12 21:33:53 +0100548fi
Erik de Castro Lopoa6a4b6f2013-11-22 18:13:36 +1100549 echo " Compiler is Clang : ................... ${xiph_cv_c_compiler_clang}"
Erik de Castro Lopo98639982014-03-15 16:47:49 +1100550 echo " SSE optimizations : ................... ${sse_os}"
Erik de Castro Lopo899599e2013-09-25 23:26:49 +1000551 echo " Asm optimizations : ................... ${asm_optimisation}"
Erik de Castro Lopoe21237a2013-09-15 19:58:05 +1000552 echo " Ogg/FLAC support : .................... ${have_ogg}"
Erik de Castro Lopo592021e2012-12-28 09:49:50 +1100553echo