• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#  FLAC - Free Lossless Audio Codec
2#  Copyright (C) 2001-2009  Josh Coalson
3#  Copyright (C) 2011-2022  Xiph.Org Foundation
4#
5#  This file is part the FLAC project.  FLAC is comprised of several
6#  components distributed under different licenses.  The codec libraries
7#  are distributed under Xiph.Org's BSD-like license (see the file
8#  COPYING.Xiph in this distribution).  All other programs, libraries, and
9#  plugins are distributed under the GPL (see COPYING.GPL).  The documentation
10#  is distributed under the Gnu FDL (see COPYING.FDL).  Each file in the
11#  FLAC distribution contains at the top the terms under which it may be
12#  distributed.
13#
14#  Since this particular file is relevant to all components of FLAC,
15#  it may be distributed under the Xiph.Org license, which is the least
16#  restrictive of those mentioned above.  See the file COPYING.Xiph in this
17#  distribution.
18
19# NOTE that for many of the AM_CONDITIONALs we use the prefix FLaC__
20# instead of FLAC__ since autoconf triggers off 'AC_' in strings
21
22AC_PREREQ(2.60)
23AC_INIT([flac],[1.4.2],[flac-dev@xiph.org],[flac],[https://www.xiph.org/flac/])
24AC_CONFIG_HEADERS([config.h])
25AC_CONFIG_SRCDIR([src/flac/main.c])
26AC_CONFIG_MACRO_DIR([m4])
27AM_INIT_AUTOMAKE([foreign 1.10 -Wall tar-pax no-dist-gzip dist-xz subdir-objects])
28m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
29
30AX_CHECK_ENABLE_DEBUG
31user_cflags=$CFLAGS
32
33#Prefer whatever the current ISO standard is.
34AC_PROG_CC
35AC_USE_SYSTEM_EXTENSIONS
36m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
37LT_INIT([win32-dll disable-static pic-only])
38AM_PROG_AS
39AC_PROG_CXX
40XIPH_C_COMPILER_IS_CLANG
41XIPH_GCC_REALLY_IS_GCC
42AC_PROG_MAKE_SET
43AC_PROG_MKDIR_P
44
45AC_SYS_LARGEFILE
46AC_FUNC_FSEEKO
47
48AC_CHECK_SIZEOF(off_t,1)	# Fake default value.
49AC_CHECK_SIZEOF([void*])
50AC_SEARCH_LIBS([lround],[m], [AC_DEFINE(HAVE_LROUND,1,lround support)])
51
52AM_PROG_CC_C_O
53AC_C_INLINE
54AC_C_TYPEOF
55
56AC_CHECK_HEADERS([stdint.h stdbool.h inttypes.h byteswap.h sys/auxv.h sys/param.h sys/ioctl.h termios.h x86intrin.h cpuid.h arm_neon.h])
57
58if test "x$ac_cv_header_stdint_h" != xyes -o "x$ac_cv_header_stdbool_h" != xyes; then
59AC_MSG_ERROR("Header stdint.h and/or stdbool.h not found")
60fi
61
62
63XIPH_C_BSWAP32
64XIPH_C_BSWAP16
65
66ac_cv_c_big_endian=0
67ac_cv_c_little_endian=0
68AC_C_BIGENDIAN([ac_cv_c_big_endian=1], [ac_cv_c_little_endian=1], [
69	AC_MSG_WARN([[*****************************************************************]])
70	AC_MSG_WARN([[*** Not able to determine endian-ness of target processor.       ]])
71	AC_MSG_WARN([[*** The constants CPU_IS_BIG_ENDIAN and CPU_IS_LITTLE_ENDIAN in  ]])
72	AC_MSG_WARN([[*** config.h may need to be hand editied.                        ]])
73	AC_MSG_WARN([[*****************************************************************]])
74])
75AC_DEFINE_UNQUOTED(CPU_IS_BIG_ENDIAN, ${ac_cv_c_big_endian},
76					[Target processor is big endian.])
77AC_DEFINE_UNQUOTED(CPU_IS_LITTLE_ENDIAN, ${ac_cv_c_little_endian},
78					[Target processor is little endian.])
79AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, ${ac_cv_c_big_endian},
80					[Target processor is big endian.])
81
82AC_ARG_ENABLE(asm-optimizations, AS_HELP_STRING([--disable-asm-optimizations],[Do not use any CPU specific optimization routines]), asm_opt=no, asm_opt=yes)
83AM_CONDITIONAL(FLaC__NO_ASM, test "x$asm_opt" = xno)
84if test "x$asm_opt" = xno ; then
85AC_DEFINE(FLAC__NO_ASM)
86AH_TEMPLATE(FLAC__NO_ASM, [define to disable use of assembly code])
87fi
88
89dnl check for getauxval in standard library
90AC_CHECK_FUNCS(getauxval)
91
92dnl check for getopt in standard library
93dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
94AC_CHECK_FUNCS(getopt_long, [], [])
95
96AC_CHECK_SIZEOF(void*,1)
97
98asm_optimisation=no
99case "$host_cpu" in
100	amd64|x86_64)
101		case "$host" in
102			*gnux32)
103				# x32 user space and 64 bit kernel.
104				cpu_x86_64=true
105				AC_DEFINE(FLAC__CPU_X86_64)
106				AH_TEMPLATE(FLAC__CPU_X86_64, [define if building for x86_64])
107				;;
108			*)
109				if test $ac_cv_sizeof_voidp = 4 ; then
110					# This must be a 32 bit user space running on 64 bit kernel so treat
111					# this as ia32.
112					cpu_ia32=true
113					AC_DEFINE(FLAC__CPU_IA32)
114					AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
115			else
116					# x86_64 user space and kernel.
117					cpu_x86_64=true
118					AC_DEFINE(FLAC__CPU_X86_64)
119					AH_TEMPLATE(FLAC__CPU_X86_64, [define if building for x86_64])
120				fi
121				;;
122		esac
123		;;
124	i*86)
125		cpu_ia32=true
126		AC_DEFINE(FLAC__CPU_IA32)
127		AH_TEMPLATE(FLAC__CPU_IA32, [define if building for ia32/i386])
128		;;
129	arm64|aarch64)
130		cpu_arm64=true
131		AC_DEFINE(FLAC__CPU_ARM64)
132		AH_TEMPLATE(FLAC__CPU_ARM64, [define if building for ARM])
133		;;
134esac
135AM_CONDITIONAL(FLAC__CPU_X86_64, test "x$cpu_x86_64" = xtrue)
136AM_CONDITIONAL(FLaC__CPU_IA32, test "x$cpu_ia32" = xtrue)
137AM_CONDITIONAL(FLAC__CPU_ARM64, test "x$cpu_arm64" = xtrue)
138
139if test "x$ac_cv_header_x86intrin_h" = xyes -a "x$asm_opt" = xyes; then
140  AC_DEFINE([FLAC__HAS_X86INTRIN], 1, [Set to 1 if <x86intrin.h> is available.])
141  asm_optimisation=yes
142else
143  AC_DEFINE([FLAC__HAS_X86INTRIN], 0)
144fi
145
146if test "x$ac_cv_header_arm_neon_h" = xyes -a "x$asm_opt" = xyes; then
147  AC_DEFINE([FLAC__HAS_NEONINTRIN], 1, [Set to 1 if <arm_neon.h> is available.])
148  AC_MSG_CHECKING([whether arm_neon.h has A64 functions])
149  AC_COMPILE_IFELSE(
150	[AC_LANG_PROGRAM([[#include <arm_neon.h>]],
151	[[float64x2_t sum5; sum5 = vdupq_n_f64(0.0f);]])],
152	[AC_MSG_RESULT([yes])
153	 has_a64neon=yes],
154	[AC_MSG_RESULT([no])])
155  if test "x$has_a64neon" = xyes; then
156    AC_DEFINE([FLAC__HAS_A64NEONINTRIN], 1, [Set to 1 if <arm_neon.h> has A64 instructions.])
157    asm_optimisation=yes
158  else
159    AC_DEFINE([FLAC__HAS_A64NEONINTRIN], 0)
160  fi
161else
162  AC_DEFINE([FLAC__HAS_NEONINTRIN], 0)
163fi
164
165case "$host" in
166	i386-*-openbsd3.[[0-3]]) OBJ_FORMAT=aoutb ;;
167	*-*-cygwin|*mingw*) OBJ_FORMAT=win32 ;;
168	*-*-darwin*) OBJ_FORMAT=macho ;;
169	*emx*) OBJ_FORMAT=aout ;;
170	*djgpp) OBJ_FORMAT=coff ;;
171	*) OBJ_FORMAT=elf ;;
172esac
173AC_SUBST(OBJ_FORMAT)
174
175os_is_windows=no
176case "$host" in
177	*mingw*)
178		os_is_windows=yes
179		;;
180esac
181
182AM_CONDITIONAL(OS_IS_WINDOWS, test "x$os_is_windows" = xyes)
183
184case "$host" in
185	*-linux-*)
186		sys_linux=true
187		AC_DEFINE(FLAC__SYS_LINUX)
188		AH_TEMPLATE(FLAC__SYS_LINUX, [define if building for Linux])
189		;;
190	*-*-darwin*)
191		sys_darwin=true
192		AC_DEFINE(FLAC__SYS_DARWIN)
193		AH_TEMPLATE(FLAC__SYS_DARWIN, [define if building for Darwin / MacOS X])
194		;;
195esac
196AM_CONDITIONAL(FLaC__SYS_DARWIN, test "x$sys_darwin" = xtrue)
197AM_CONDITIONAL(FLaC__SYS_LINUX, test "x$sys_linux" = xtrue)
198
199if test "x$cpu_ia32" = xtrue || test "x$cpu_x86_64" = xtrue ; then
200AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
201AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA, [define to align allocated memory on 32-byte boundaries])
202fi
203
204AM_CONDITIONAL([DEBUG], [test "x${ax_enable_debug}" = "xyes" || test "x${ax_enable_debug}" = "xinfo"])
205
206AC_ARG_ENABLE(avx,
207AS_HELP_STRING([--disable-avx],[Disable AVX, AVX2 optimizations. There is runtime detection of CPU features, so disabling is only necessary when a compiler does not know about them]),
208[case "${enableval}" in
209	yes) use_avx=true ;;
210	no)  use_avx=false ;;
211	*) AC_MSG_ERROR(bad value ${enableval} for --enable-avx) ;;
212esac],[use_avx=true])
213AM_CONDITIONAL(FLaC__USE_AVX, test "x$use_avx" = xtrue)
214if test "x$use_avx" = xtrue ; then
215AC_DEFINE(FLAC__USE_AVX)
216AH_TEMPLATE(FLAC__USE_AVX, [define to enable use of AVX instructions])
217fi
218
219AC_ARG_ENABLE(thorough-tests,
220AS_HELP_STRING([--disable-thorough-tests],[Disable thorough (long) testing, do only basic tests]),
221[case "${enableval}" in
222	yes) thorough_tests=true ;;
223	no)  thorough_tests=false ;;
224	*) AC_MSG_ERROR(bad value ${enableval} for --enable-thorough-tests) ;;
225esac],[thorough_tests=true])
226AC_ARG_ENABLE(exhaustive-tests,
227AS_HELP_STRING([--enable-exhaustive-tests],[Enable exhaustive testing (VERY long)]),
228[case "${enableval}" in
229	yes) exhaustive_tests=true ;;
230	no)  exhaustive_tests=false ;;
231	*) AC_MSG_ERROR(bad value ${enableval} for --enable-exhaustive-tests) ;;
232esac],[exhaustive_tests=false])
233if test "x$thorough_tests" = xfalse ; then
234FLAC__TEST_LEVEL=0
235elif test "x$exhaustive_tests" = xfalse ; then
236FLAC__TEST_LEVEL=1
237else
238FLAC__TEST_LEVEL=2
239fi
240AC_SUBST(FLAC__TEST_LEVEL)
241
242AC_ARG_ENABLE(werror,
243	AS_HELP_STRING([--enable-werror],[Enable -Werror in all Makefiles]))
244
245AC_ARG_ENABLE([stack-smash-protection],
246    [AS_HELP_STRING([--disable-stack-smash-protection],[Disable GNU GCC stack smash protection])],,
247    [AS_IF([test "$ac_cv_c_compiler_gnu" = "yes"],
248        [enable_stack_smash_protection=yes],[enable_stack_smash_protection=no])])
249
250AC_ARG_ENABLE([fortify-source],
251    [AS_HELP_STRING([--disable-fortify-source],[Disable _FORTIFY_SOURCE buffer overflow protection])],,
252    [AS_IF([test "$ac_cv_c_compiler_gnu" = "yes"],
253        [enable_fortify_source=yes],[enable_fortify_source=no])])
254
255case "$host" in
256	*mingw*)
257		if test "$enable_fortify_source" = "yes"; then
258			AC_SEARCH_LIBS(__memset_chk, ssp, , mingw_has_memset_chk=no)
259		fi
260		if test "$enable_stack_smash_protection" = "yes"; then
261			AC_SEARCH_LIBS(__stack_chk_fail, ssp, , mingw_has_stack_chk_fail=no)
262		fi
263	;;
264esac
265
266
267AC_ARG_ENABLE(64-bit-words,
268	AS_HELP_STRING([--enable-64-bit-words],[Set FLAC__BYTES_PER_WORD to 8 (4 is the default)]))
269if test "x$enable_64_bit_words" = xyes ; then
270	AC_DEFINE_UNQUOTED([ENABLE_64_BIT_WORDS],1,[Set FLAC__BYTES_PER_WORD to 8 (4 is the default)])
271else
272	AC_DEFINE_UNQUOTED([ENABLE_64_BIT_WORDS],0)
273	fi
274AC_SUBST(ENABLE_64_BIT_WORDS)
275
276AC_ARG_ENABLE(valgrind-testing,
277AS_HELP_STRING([--enable-valgrind-testing],[Run all tests inside Valgrind]),
278[case "${enableval}" in
279	yes) FLAC__TEST_WITH_VALGRIND=yes ;;
280	no)  FLAC__TEST_WITH_VALGRIND=no ;;
281	*) AC_MSG_ERROR(bad value ${enableval} for --enable-valgrind-testing) ;;
282esac],[FLAC__TEST_WITH_VALGRIND=no])
283AC_SUBST(FLAC__TEST_WITH_VALGRIND)
284
285AC_ARG_ENABLE(doxygen-docs,
286AS_HELP_STRING([--disable-doxygen-docs],[Disable API documentation building via Doxygen]),
287[case "${enableval}" in
288	yes) enable_doxygen_docs=true ;;
289	no)  enable_doxygen_docs=false ;;
290	*) AC_MSG_ERROR(bad value ${enableval} for --enable-doxygen-docs) ;;
291esac],[enable_doxygen_docs=true])
292if test "x$enable_doxygen_docs" != xfalse ; then
293	AC_CHECK_PROGS(DOXYGEN, doxygen)
294fi
295AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
296
297if test ! -n "$DOXYGEN" && test -f "$srcdir/doc/FLAC.tag" && test -f "$srcdir/doc/api/modules.html" ; then
298	HAS_PREBUILT_DOXYGEN=yes
299fi
300AM_CONDITIONAL(FLaC__HAS_PREBUILT_DOXYGEN, test "x$HAS_PREBUILT_DOXYGEN" = xyes)
301
302dnl build FLAC++ or not
303AC_ARG_ENABLE([cpplibs],
304AS_HELP_STRING([--disable-cpplibs],[Do not build libFLAC++]),
305[case "${enableval}" in
306	yes) disable_cpplibs=false ;;
307	no)  disable_cpplibs=true ;;
308	*)   AC_MSG_ERROR(bad value ${enableval} for --enable-cpplibs) ;;
309esac], [disable_cpplibs=false])
310AM_CONDITIONAL(FLaC__WITH_CPPLIBS, [test "x$disable_cpplibs" != xtrue])
311
312AC_ARG_ENABLE([oss-fuzzers],
313  [AS_HELP_STRING([--enable-oss-fuzzers],
314    [Whether to generate the fuzzers for OSS-Fuzz (Clang only)])],
315  [have_oss_fuzzers=yes], [have_oss_fuzzers=no])
316
317if test "x$have_oss_fuzzers" = "xyes"; then
318  if test "x$xiph_cv_c_compiler_clang" = "xyes" ; then
319    AM_CONDITIONAL([USE_OSSFUZZERS], [test "x$have_oss_fuzzers" = "xyes"])
320    if test "x$LIB_FUZZING_ENGINE" = "x" ; then
321      # Only set this if it is empty.
322	  LIB_FUZZING_ENGINE=-fsanitize=fuzzer
323    fi
324  else
325    AM_CONDITIONAL([USE_OSSFUZZERS], [test "false" = "true"])
326    # Disable fuzzer if the compiler is not Clang.
327    AC_MSG_WARN([*** Ozz-Fuzz is disabled because that requires the Clang compiler.])
328    have_oss_fuzzers="no (compiler is not Clang)"
329  fi
330else
331  AM_CONDITIONAL([USE_OSSFUZZERS], [test "false" = "true"])
332fi
333
334AC_SUBST([LIB_FUZZING_ENGINE])
335
336dnl check for ogg library
337AC_ARG_ENABLE([ogg],
338	AS_HELP_STRING([--disable-ogg],[Disable ogg support (default: test for libogg)]),
339	[ want_ogg=$enableval ], [ want_ogg=yes ] )
340
341if test "x$want_ogg" != "xno"; then
342	XIPH_PATH_OGG(have_ogg=yes, AC_MSG_WARN([*** Ogg development environment not installed - Ogg support will not be built]))
343fi
344
345FLAC__HAS_OGG=0
346AM_CONDITIONAL(FLaC__HAS_OGG, [test "x$have_ogg" = xyes])
347if test "x$have_ogg" = xyes ; then
348	FLAC__HAS_OGG=1
349	OGG_PACKAGE="ogg"
350else
351	have_ogg=no
352fi
353AC_DEFINE_UNQUOTED([FLAC__HAS_OGG],$FLAC__HAS_OGG,[define if you have the ogg library])
354AC_SUBST(FLAC__HAS_OGG)
355AC_SUBST(OGG_PACKAGE)
356
357dnl Build programs?
358AC_ARG_ENABLE([programs],
359	AS_HELP_STRING([--disable-programs], [Do not build and install flac and metaflac]))
360AM_CONDITIONAL(FLaC__WITH_PROGRAMS, [test "x$enable_programs" != "xno"])
361
362dnl Build examples?
363AC_ARG_ENABLE([examples],
364	AS_HELP_STRING([--disable-examples], [Do not build and install examples]))
365AM_CONDITIONAL([EXAMPLES], [test "x$enable_examples" != "xno"])
366
367dnl Ask git which version FLAC is
368AC_ARG_ENABLE([version-from-git],
369	AS_HELP_STRING([--disable-version-from-git], [Do not use git tag, commit hash and commit date for version number]),
370       [ enable_version_from_git=$enableval ], [ enable_version_from_git=yes ])
371
372
373dnl check for i18n(internationalization); these are from libiconv/gettext
374AM_ICONV
375AM_LANGINFO_CODESET
376
377AC_CHECK_PROGS(PANDOC, pandoc)
378AM_CONDITIONAL(FLaC__HAS_PANDOC, test -n "$PANDOC")
379if test -n "$PANDOC" ; then
380	AC_DEFINE(FLAC__HAS_PANDOC)
381	AH_TEMPLATE(FLAC__HAS_PANDOC, [define if you have pandoc])
382else
383if test -f "$srcdir/man/flac.1" && test -f "$srcdir/man/metaflac.1" ; then
384	HAS_PREBUILT_MANPAGES=yes
385fi
386fi
387AM_CONDITIONAL(FLaC__HAS_PREBUILT_MANPAGES, test "x$HAS_PREBUILT_MANPAGES" = "xyes")
388
389AC_CHECK_LIB(rt, clock_gettime,
390        LIB_CLOCK_GETTIME=-lrt
391        AC_DEFINE(HAVE_CLOCK_GETTIME)
392        AH_TEMPLATE(HAVE_CLOCK_GETTIME, [define if you have clock_gettime]))
393AC_SUBST(LIB_CLOCK_GETTIME)
394
395XIPH_GCC_VERSION dnl Sets a non-zero GCC_XXX_VERSION for gcc, not clang. checks below rely on that..
396
397if test x$ac_cv_c_compiler_gnu = xyes -o x$xiph_cv_c_compiler_clang = xyes ; then
398	dnl Prepend defaults to CFLAGS for GCC and Clang
399	AS_IF([test "x${ax_enable_debug}" = "xno"], [
400		CFLAGS="-O3 -funroll-loops $CFLAGS"
401		CXXFLAGS="-O3 $CXXFLAGS"
402	])
403
404	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
405	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
406
407	XIPH_ADD_CFLAGS([-Wdeclaration-after-statement])
408
409	dnl some distributions (such as Gentoo) have _FORTIFY_SOURCE always
410	dnl enabled. We test for this situation in order to prevent polluting
411	dnl the console with messages of macro redefinitions.
412
413	if test "$enable_fortify_source" = "yes" && test "x$mingw_has_memset_chk" != "xno"
414	then
415		AX_ADD_FORTIFY_SOURCE
416	fi
417
418	AC_LANG_PUSH([C++])
419	XIPH_ADD_CXXFLAGS([-Weffc++])
420	AC_LANG_POP([C++])
421
422	if test x$xiph_cv_c_compiler_clang = xyes -a "$OBJ_FORMAT" = elf; then
423		CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
424		CFLAGS="$CFLAGS -fvisibility=hidden"
425		CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
426	elif test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = elf; then
427		CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
428		CFLAGS="$CFLAGS -fvisibility=hidden"
429		CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
430		fi
431
432
433	if test x$xiph_cv_c_compiler_clang = xyes -a "$OBJ_FORMAT" = macho; then
434		CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
435		CFLAGS="$CFLAGS -fvisibility=hidden"
436		CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
437	elif test "$GCC_MAJOR_VERSION" -ge 4 && test "$OBJ_FORMAT" = macho; then
438		CPPFLAGS="$CPPFLAGS -DFLAC__USE_VISIBILITY_ATTR"
439		CFLAGS="$CFLAGS -fvisibility=hidden"
440		CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
441		fi
442
443	if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x42" ; then
444		XIPH_ADD_CFLAGS([-fgnu89-inline])
445		fi
446
447	if test "x$GCC_MAJOR_VERSION$GCC_MINOR_VERSION" = "x47" ; then
448		XIPH_ADD_CFLAGS([-fno-inline-small-functions])
449		fi
450
451	fi
452
453case "$host_os" in
454	"mingw32"|"os2")
455	if test "$host_cpu" = "i686"; then
456		XIPH_ADD_CFLAGS([-mstackrealign])
457		fi
458	esac
459
460if test x$enable_werror = "xyes" ; then
461	XIPH_ADD_CFLAGS([-Werror])
462	AC_LANG_PUSH([C++])
463	XIPH_ADD_CXXFLAGS([-Werror])
464	AC_LANG_POP([C++])
465	fi
466
467if test x$enable_stack_smash_protection = "xyes" && test "x$mingw_has_stack_chk_fail" != "xno" ; then
468	XIPH_GCC_STACK_PROTECTOR
469	XIPH_GXX_STACK_PROTECTOR
470else
471	enable_stack_smash_protection=no
472fi
473
474AH_VERBATIM([FLAC_API_EXPORTS],
475[/* libtool defines DLL_EXPORT for windows dll builds,
476   but flac code relies on FLAC_API_EXPORTS instead. */
477#ifdef DLL_EXPORT
478#ifdef __cplusplus
479# define FLACPP_API_EXPORTS
480#else
481# define FLAC_API_EXPORTS
482#endif
483#endif])
484
485if test x$enable_static = "xyes" ; then
486dnl for correct FLAC_API
487	CPPFLAGS="-DFLAC__NO_DLL $CPPFLAGS"
488	fi
489
490AC_CHECK_PROG(GIT_FOUND,git,yes)
491
492if test x$GIT_FOUND$enable_version_from_git = "xyesyes"; then
493	GIT_COMMIT_TAG=`git -C $srcdir --git-dir=.git describe --tags --exact-match 2>/dev/null`
494	GIT_COMMIT_HASH=`git -C $srcdir --git-dir=.git log -1 --pretty=format:%h 2>/dev/null`
495	GIT_COMMIT_DATE=`git -C $srcdir --git-dir=.git log -1 --pretty=format:%cd --date=format:%Y%m%d 2>/dev/null`
496	if test ${#GIT_COMMIT_HASH} = 8 && test ${#GIT_COMMIT_DATE} = 8; then
497		GIT_COMMIT_VERSION_AVAIL=yes
498		if test ${#GIT_COMMIT_TAG} != 0 ; then
499			GIT_COMMIT_TAG_AVAIL=yes
500			AC_DEFINE_UNQUOTED(GIT_COMMIT_TAG, "${GIT_COMMIT_TAG}", "Define to the tag of the current git HEAD")
501		else
502			GIT_COMMIT_VERSION_HASH=yes
503		fi
504		AC_DEFINE_UNQUOTED(GIT_COMMIT_HASH, "${GIT_COMMIT_HASH}", "Define to the short hash of the current git HEAD")
505		AC_DEFINE_UNQUOTED(GIT_COMMIT_DATE, "${GIT_COMMIT_DATE}", "Define to the commit date of the current git HEAD")
506	fi
507fi
508
509AC_SUBST(GIT_COMMIT_VERSION_HASH)
510
511AX_CHECK_COMPILE_FLAG([-fassociative-math -fno-signed-zeros -fno-trapping-math -freciprocal-math],HAVE_ASSOC_MATH=yes)
512AM_CONDITIONAL(ASSOC_MATH_AVAILABLE, test "x$HAVE_ASSOC_MATH" = "xyes")
513
514
515AC_CONFIG_FILES([ \
516	Makefile \
517	src/Makefile \
518	src/libFLAC/Makefile \
519	src/libFLAC/flac.pc \
520	src/libFLAC/include/Makefile \
521	src/libFLAC/include/private/Makefile \
522	src/libFLAC/include/protected/Makefile \
523	src/libFLAC++/Makefile \
524	src/libFLAC++/flac++.pc \
525	src/flac/Makefile \
526	src/metaflac/Makefile \
527	src/share/Makefile \
528	src/test_grabbag/Makefile \
529	src/test_grabbag/cuesheet/Makefile \
530	src/test_grabbag/picture/Makefile \
531	src/test_libs_common/Makefile \
532	src/test_libFLAC/Makefile \
533	src/test_libFLAC++/Makefile \
534	src/test_seeking/Makefile \
535	src/test_streams/Makefile \
536	src/utils/Makefile \
537	src/utils/flacdiff/Makefile \
538	src/utils/flactimer/Makefile \
539	examples/Makefile \
540	examples/c/Makefile \
541	examples/c/decode/Makefile \
542	examples/c/decode/file/Makefile \
543	examples/c/encode/Makefile \
544	examples/c/encode/file/Makefile \
545	examples/cpp/Makefile \
546	examples/cpp/decode/Makefile \
547	examples/cpp/decode/file/Makefile \
548	examples/cpp/encode/Makefile \
549	examples/cpp/encode/file/Makefile \
550	include/Makefile \
551	include/FLAC/Makefile \
552	include/FLAC++/Makefile \
553	include/share/Makefile \
554	include/share/grabbag/Makefile \
555	include/test_libs_common/Makefile \
556	doc/Doxyfile \
557	doc/Makefile \
558	doc/images/Makefile \
559	m4/Makefile \
560	man/Makefile \
561	test/common.sh \
562	test/Makefile \
563	test/cuesheets/Makefile \
564	test/foreign-metadata-test-files/Makefile \
565	test/flac-to-flac-metadata-test-files/Makefile \
566	test/metaflac-test-files/Makefile \
567	test/pictures/Makefile \
568	microbench/Makefile \
569	oss-fuzz/Makefile
570])
571AC_OUTPUT
572
573AC_MSG_RESULT([
574-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-
575
576  Configuration summary :
577
578    FLAC version : ............................ ${VERSION}
579
580    Host CPU : ................................ ${host_cpu}
581    Host Vendor : ............................. ${host_vendor}
582    Host OS : ................................. ${host_os}
583])
584
585if test x$GIT_COMMIT_TAG_AVAIL = xyes ; then
586	echo "    Version string : reference libFLAC ${GIT_COMMIT_TAG} ${GIT_COMMIT_DATE}"
587elif test x$GIT_COMMIT_VERSION_AVAIL = xyes ; then
588	echo "    Version string : reference libFLAC git-${GIT_COMMIT_HASH} ${GIT_COMMIT_DATE}"
589fi
590	echo ""
591	echo "    Compiler is GCC : ......................... ${ac_cv_c_compiler_gnu}"
592if test x$ac_cv_c_compiler_gnu = xyes ; then
593	echo "    GCC version : ............................. ${GCC_VERSION}"
594fi
595	echo "    Compiler is Clang : ....................... ${xiph_cv_c_compiler_clang}"
596	echo "    Asm optimizations : ....................... ${asm_optimisation}"
597	echo "    Ogg/FLAC support : ........................ ${have_ogg}"
598	echo "    Stack protector  : ........................ ${enable_stack_smash_protection}"
599	echo "    Fuzzing support (Clang only) : ............ ${have_oss_fuzzers}"
600echo
601