1b815c7f3Sopenharmony_cidnl Copyright (C) 1999-2022  Erik de Castro Lopo <erikd@mega-nerd.com>.
2b815c7f3Sopenharmony_ci
3b815c7f3Sopenharmony_cidnl Require autoconf version >= 2.69
4b815c7f3Sopenharmony_ciAC_PREREQ([2.69])
5b815c7f3Sopenharmony_ci
6b815c7f3Sopenharmony_ciAC_INIT([libsndfile],[1.2.0],[sndfile@mega-nerd.com],
7b815c7f3Sopenharmony_ci		[libsndfile],[http://libsndfile.github.io/libsndfile/])
8b815c7f3Sopenharmony_ci
9b815c7f3Sopenharmony_cidnl Check whether we want to set defaults for CFLAGS, CXXFLAGS, CPPFLAGS and LDFLAGS
10b815c7f3Sopenharmony_ciAC_MSG_CHECKING([whether configure should try to set CFLAGS/CXXFLAGS/CPPFLAGS/LDFLAGS])
11b815c7f3Sopenharmony_ciAS_IF([test "x${CFLAGS+set}" = "xset" || test "x${CXXFLAGS+set}" = "xset" || test "x${CPPFLAGS+set}" = "xset" || test "x${LDFLAGS+set}" = "xset"], [
12b815c7f3Sopenharmony_ci		enable_flags_setting=no
13b815c7f3Sopenharmony_ci		: ${CFLAGS=""}
14b815c7f3Sopenharmony_ci		: ${CXXFLAGS=""}
15b815c7f3Sopenharmony_ci	], [
16b815c7f3Sopenharmony_ci		enable_flags_setting=yes
17b815c7f3Sopenharmony_ci		dnl Set to empty flags so AC_PROG_CC and
18b815c7f3Sopenharmony_ci		dnl AC_PROG_CXX do not add -g -O2
19b815c7f3Sopenharmony_ci		CFLAGS=""
20b815c7f3Sopenharmony_ci		CXXFLAGS=""
21b815c7f3Sopenharmony_ci	])
22b815c7f3Sopenharmony_ciAC_MSG_RESULT([${enable_flags_setting}])
23b815c7f3Sopenharmony_ci
24b815c7f3Sopenharmony_cidnl Put config stuff in 'build-aux'.
25b815c7f3Sopenharmony_ciAC_CONFIG_AUX_DIR([build-aux])
26b815c7f3Sopenharmony_ci
27b815c7f3Sopenharmony_ciAC_CONFIG_SRCDIR([src/sndfile.c])
28b815c7f3Sopenharmony_ciAC_CANONICAL_HOST
29b815c7f3Sopenharmony_ci
30b815c7f3Sopenharmony_ciAC_CONFIG_MACRO_DIR([m4])
31b815c7f3Sopenharmony_ciAC_CONFIG_HEADERS([src/config.h])
32b815c7f3Sopenharmony_ci
33b815c7f3Sopenharmony_ciAM_INIT_AUTOMAKE([1.14 foreign dist-xz no-dist-gzip serial-tests subdir-objects])
34b815c7f3Sopenharmony_ciAM_SILENT_RULES([yes])
35b815c7f3Sopenharmony_ci
36b815c7f3Sopenharmony_cidnl ====================================================================================
37b815c7f3Sopenharmony_ci
38b815c7f3Sopenharmony_ciAC_PROG_CC
39b815c7f3Sopenharmony_ciAC_PROG_CC_C99
40b815c7f3Sopenharmony_ci
41b815c7f3Sopenharmony_ciAS_IF([test "x$ac_cv_prog_cc_c99" = "xno"], [
42b815c7f3Sopenharmony_ci		AC_MSG_ERROR([libsndfile requires a C99 capable compiler!])
43b815c7f3Sopenharmony_ci	])
44b815c7f3Sopenharmony_ci
45b815c7f3Sopenharmony_ciAC_USE_SYSTEM_EXTENSIONS
46b815c7f3Sopenharmony_ciAC_PROG_CXX
47b815c7f3Sopenharmony_ci
48b815c7f3Sopenharmony_ciAC_LANG([C])
49b815c7f3Sopenharmony_ciAX_COMPILER_VENDOR
50b815c7f3Sopenharmony_ciAX_COMPILER_VERSION
51b815c7f3Sopenharmony_ci
52b815c7f3Sopenharmony_ciAC_LANG_PUSH([C++])
53b815c7f3Sopenharmony_ciAX_COMPILER_VENDOR
54b815c7f3Sopenharmony_ciAX_COMPILER_VERSION
55b815c7f3Sopenharmony_ciAC_LANG_POP([C++])
56b815c7f3Sopenharmony_ci
57b815c7f3Sopenharmony_ciAC_PROG_SED
58b815c7f3Sopenharmony_ciAM_PROG_AR
59b815c7f3Sopenharmony_ci
60b815c7f3Sopenharmony_ciLT_INIT([disable-static win32-dll])
61b815c7f3Sopenharmony_ciLT_PROG_RC
62b815c7f3Sopenharmony_ci
63b815c7f3Sopenharmony_ciAC_PROG_INSTALL
64b815c7f3Sopenharmony_ciAC_PROG_LN_S
65b815c7f3Sopenharmony_ci
66b815c7f3Sopenharmony_ciAM_PATH_PYTHON
67b815c7f3Sopenharmony_ci
68b815c7f3Sopenharmony_ciAC_CHECK_PROG([HAVE_AUTOGEN], [autogen], [yes], [no])
69b815c7f3Sopenharmony_ciAC_CHECK_PROG([HAVE_WINE], [wine], [yes], [no])
70b815c7f3Sopenharmony_ciAC_CHECK_PROG([HAVE_XCODE_SELECT], [xcode-select], [yes], [no])
71b815c7f3Sopenharmony_ci
72b815c7f3Sopenharmony_cidnl ------------------------------------------------------------------------------------
73b815c7f3Sopenharmony_cidnl  Rules for library version information:
74b815c7f3Sopenharmony_cidnl
75b815c7f3Sopenharmony_cidnl   1. Start with version information of `0:0:0' for each libtool library.
76b815c7f3Sopenharmony_cidnl   2. Update the version information only immediately before a public release of
77b815c7f3Sopenharmony_cidnl      your software. More frequent updates are unnecessary, and only guarantee
78b815c7f3Sopenharmony_cidnl      that the current interface number gets larger faster.
79b815c7f3Sopenharmony_cidnl   3. If the library source code has changed at all since the last update, then
80b815c7f3Sopenharmony_cidnl      increment revision (`c:r:a' becomes `c:r+1:a').
81b815c7f3Sopenharmony_cidnl   4. If any interfaces have been added, removed, or changed since the last update,
82b815c7f3Sopenharmony_cidnl      increment current, and set revision to 0.
83b815c7f3Sopenharmony_cidnl   5. If any interfaces have been added since the last public release, then increment
84b815c7f3Sopenharmony_cidnl      age.
85b815c7f3Sopenharmony_cidnl   6. If any interfaces have been removed since the last public release, then set age
86b815c7f3Sopenharmony_cidnl      to 0.
87b815c7f3Sopenharmony_ci
88b815c7f3Sopenharmony_cidnl   This is libtool version of library, we add it to `--version-info` property.
89b815c7f3Sopenharmony_ci
90b815c7f3Sopenharmony_cim4_define([lt_current], [1])
91b815c7f3Sopenharmony_cim4_define([lt_revision], [35])
92b815c7f3Sopenharmony_cim4_define([lt_age], [0])
93b815c7f3Sopenharmony_ci
94b815c7f3Sopenharmony_cidnl This is ABI version for linker scripts, CMake uses the same format for
95b815c7f3Sopenharmony_cidnl VERSION property of shared library.
96b815c7f3Sopenharmony_cidnl The formula is: c:r:a -> c-a:a:r
97b815c7f3Sopenharmony_ci
98b815c7f3Sopenharmony_cim4_define([abi_version_major], [m4_eval(lt_current - lt_age)])
99b815c7f3Sopenharmony_cim4_define([abi_version_minor], [lt_age])
100b815c7f3Sopenharmony_cim4_define([abi_version_patch], [lt_revision])
101b815c7f3Sopenharmony_ci
102b815c7f3Sopenharmony_cidnl ------------------------------------------------------------------------------------
103b815c7f3Sopenharmony_ci
104b815c7f3Sopenharmony_ciAC_CHECK_HEADERS([endian.h])
105b815c7f3Sopenharmony_ciAC_CHECK_HEADERS([byteswap.h])
106b815c7f3Sopenharmony_ciAC_CHECK_HEADERS([locale.h])
107b815c7f3Sopenharmony_ciAC_CHECK_HEADERS([sys/time.h])
108b815c7f3Sopenharmony_ciAC_CHECK_HEADERS([immintrin.h])
109b815c7f3Sopenharmony_ciAC_CHECK_HEADERS([stdbool.h])
110b815c7f3Sopenharmony_ci
111b815c7f3Sopenharmony_ciAC_HEADER_SYS_WAIT
112b815c7f3Sopenharmony_ci
113b815c7f3Sopenharmony_ciAC_CHECK_DECLS([S_IRGRP])
114b815c7f3Sopenharmony_ciAS_IF([test "x$ac_cv_have_decl_S_IRGRP" = "xyes"], [
115b815c7f3Sopenharmony_ci		AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP], [1], [Set to 1 if S_IRGRP is defined.])
116b815c7f3Sopenharmony_ci	], [
117b815c7f3Sopenharmony_ci		AC_DEFINE_UNQUOTED([HAVE_DECL_S_IRGRP], [0], [Set to 0 if S_IRGRP is not defined.])
118b815c7f3Sopenharmony_ci	])
119b815c7f3Sopenharmony_ci
120b815c7f3Sopenharmony_ciAM_CONDITIONAL([LINUX_MINGW_CROSS_TEST],
121b815c7f3Sopenharmony_ci	[test "x${build_os}:${host_os}:${HAVE_WINE}" = "xlinux-gnu:mingw32msvc:yes"])
122b815c7f3Sopenharmony_ci
123b815c7f3Sopenharmony_cidnl ====================================================================================
124b815c7f3Sopenharmony_cidnl  Couple of initializations here. Fill in real values later.
125b815c7f3Sopenharmony_ci
126b815c7f3Sopenharmony_ciSHLIB_VERSION_ARG=""
127b815c7f3Sopenharmony_ci
128b815c7f3Sopenharmony_cidnl ====================================================================================
129b815c7f3Sopenharmony_cidnl  Finished checking, handle options.
130b815c7f3Sopenharmony_ci
131b815c7f3Sopenharmony_ciAC_ARG_ENABLE(experimental,
132b815c7f3Sopenharmony_ci	AS_HELP_STRING([--enable-experimental], [enable experimental code]))
133b815c7f3Sopenharmony_ci
134b815c7f3Sopenharmony_ciAS_IF([test "x$enable_experimental" = "xyes"], [
135b815c7f3Sopenharmony_ci		EXPERIMENTAL_CODE=1
136b815c7f3Sopenharmony_ci	], [
137b815c7f3Sopenharmony_ci		EXPERIMENTAL_CODE=0
138b815c7f3Sopenharmony_ci	])
139b815c7f3Sopenharmony_ciAC_DEFINE_UNQUOTED([ENABLE_EXPERIMENTAL_CODE], [${EXPERIMENTAL_CODE}], [Set to 1 to enable experimental code.])
140b815c7f3Sopenharmony_ci
141b815c7f3Sopenharmony_ciAC_ARG_ENABLE([werror],
142b815c7f3Sopenharmony_ci	[AS_HELP_STRING([--enable-werror], [enable -Werror in all Makefiles])])
143b815c7f3Sopenharmony_ci
144b815c7f3Sopenharmony_ciAC_ARG_ENABLE([cpu-clip],
145b815c7f3Sopenharmony_ci	[AS_HELP_STRING([--disable-cpu-clip], [disable tricky cpu specific clipper])])
146b815c7f3Sopenharmony_ci
147b815c7f3Sopenharmony_ciAC_ARG_ENABLE([bow-docs],
148b815c7f3Sopenharmony_ci	[AS_HELP_STRING([--enable-bow-docs], [enable black-on-white html docs])])
149b815c7f3Sopenharmony_ci
150b815c7f3Sopenharmony_ciAC_ARG_ENABLE([sqlite],
151b815c7f3Sopenharmony_ci	[AS_HELP_STRING([--disable-sqlite], [disable use of sqlite])])
152b815c7f3Sopenharmony_ci
153b815c7f3Sopenharmony_ciAC_ARG_ENABLE([alsa],
154b815c7f3Sopenharmony_ci	[AS_HELP_STRING([--disable-alsa], [disable ALSA support (default=autodetect)])], [], [enable_alsa=auto])
155b815c7f3Sopenharmony_ci
156b815c7f3Sopenharmony_ciAC_ARG_ENABLE([external-libs],
157b815c7f3Sopenharmony_ci	[AS_HELP_STRING([--disable-external-libs], [disable use of FLAC, Ogg and Vorbis [[default=no]]])])
158b815c7f3Sopenharmony_ci
159b815c7f3Sopenharmony_ciAC_ARG_ENABLE([mpeg],
160b815c7f3Sopenharmony_ci	[AS_HELP_STRING([--disable-mpeg], [disable use of LAME/MPG123 for MPEG (MP3) [[defaults=no]]])])
161b815c7f3Sopenharmony_ci
162b815c7f3Sopenharmony_ciAC_ARG_ENABLE(octave,
163b815c7f3Sopenharmony_ci	[AS_HELP_STRING([--enable-octave], [enable building of GNU Octave module])])
164b815c7f3Sopenharmony_ci
165b815c7f3Sopenharmony_ciAC_ARG_ENABLE([full-suite],
166b815c7f3Sopenharmony_ci	[AS_HELP_STRING([--disable-full-suite], [disable building and installing programs, documentation, only build library [[default=no]]])])
167b815c7f3Sopenharmony_ciAM_CONDITIONAL([FULL_SUITE], [test "x$enable_full_suite" != "xno"])
168b815c7f3Sopenharmony_ci
169b815c7f3Sopenharmony_ciAC_ARG_ENABLE([test-coverage],
170b815c7f3Sopenharmony_ci	[AS_HELP_STRING([--enable-test-coverage], [enable test coverage])])
171b815c7f3Sopenharmony_ciAM_CONDITIONAL([ENABLE_TEST_COVERAGE], [test "x$enable_test_coverage" = "xyes"])
172b815c7f3Sopenharmony_ci
173b815c7f3Sopenharmony_ciAC_ARG_ENABLE([ossfuzzers],
174b815c7f3Sopenharmony_ci	[AS_HELP_STRING([--enable-ossfuzzers], [Whether to generate the fuzzers for OSS-Fuzz])])
175b815c7f3Sopenharmony_ciAM_CONDITIONAL([USE_OSSFUZZERS], [test "x$enable_ossfuzzers" = "xyes"])
176b815c7f3Sopenharmony_ci
177b815c7f3Sopenharmony_ciAC_SUBST([LIB_FUZZING_ENGINE])
178b815c7f3Sopenharmony_ciAM_CONDITIONAL([USE_OSSFUZZ_FLAG], [test "x$LIB_FUZZING_ENGINE" = "x-fsanitize=fuzzer"])
179b815c7f3Sopenharmony_ciAM_CONDITIONAL([USE_OSSFUZZ_STATIC], [test -f "$LIB_FUZZING_ENGINE"])
180b815c7f3Sopenharmony_ci
181b815c7f3Sopenharmony_cidnl ====================================================================================
182b815c7f3Sopenharmony_cidnl  Check types and their sizes.
183b815c7f3Sopenharmony_ci
184b815c7f3Sopenharmony_ciAC_CHECK_SIZEOF([wchar_t], [4])
185b815c7f3Sopenharmony_ciAC_CHECK_SIZEOF([short], [2])
186b815c7f3Sopenharmony_ciAC_CHECK_SIZEOF([int], [4])
187b815c7f3Sopenharmony_ciAC_CHECK_SIZEOF([long], [4])
188b815c7f3Sopenharmony_ciAC_CHECK_SIZEOF([float], [4])
189b815c7f3Sopenharmony_ciAC_CHECK_SIZEOF([double], [4])
190b815c7f3Sopenharmony_ciAC_CHECK_SIZEOF([void*], [8])
191b815c7f3Sopenharmony_ciAC_CHECK_SIZEOF([size_t], [4])
192b815c7f3Sopenharmony_ciAC_CHECK_SIZEOF([int64_t], [8])
193b815c7f3Sopenharmony_ciAC_CHECK_SIZEOF([long long], [8])
194b815c7f3Sopenharmony_ci
195b815c7f3Sopenharmony_cidnl  Check for common 64 bit file offset types.
196b815c7f3Sopenharmony_ciAC_CHECK_SIZEOF([off_t], [1])
197b815c7f3Sopenharmony_ci
198b815c7f3Sopenharmony_ciAS_IF([test "x$enable_largefile:$ac_cv_sizeof_off_t" = "xno:8"], [
199b815c7f3Sopenharmony_ci		AC_MSG_ERROR(["Error : Cannot disable large file support because sizeof (off_t) == 8."])
200b815c7f3Sopenharmony_ci	])
201b815c7f3Sopenharmony_ci
202b815c7f3Sopenharmony_ciAS_CASE([$host_os],
203b815c7f3Sopenharmony_ci	[mingw32*], [
204b815c7f3Sopenharmony_ci		AC_DEFINE([__USE_MINGW_ANSI_STDIO], [1], [Set to 1 to use C99 printf/snprintf in MinGW.])
205b815c7f3Sopenharmony_ci		],
206b815c7f3Sopenharmony_ci
207b815c7f3Sopenharmony_ci	[
208b815c7f3Sopenharmony_ci		AS_IF([test "x$ac_cv_sizeof_off_t" = "x8"], [
209b815c7f3Sopenharmony_ci				dnl If sizeof (off_t) is 8, no further checking is needed.
210b815c7f3Sopenharmony_ci			], [
211b815c7f3Sopenharmony_ci				dnl Save the old sizeof (off_t) value  and then unset it to see if it
212b815c7f3Sopenharmony_ci				dnl changes when Large File Support is enabled.
213b815c7f3Sopenharmony_ci				pre_largefile_sizeof_off_t=$ac_cv_sizeof_off_t
214b815c7f3Sopenharmony_ci				unset ac_cv_sizeof_off_t
215b815c7f3Sopenharmony_ci
216b815c7f3Sopenharmony_ci				AC_SYS_LARGEFILE
217b815c7f3Sopenharmony_ci				AS_IF([test "x$ac_cv_sys_largefile_CFLAGS" = "xno"], [
218b815c7f3Sopenharmony_ci						ac_cv_sys_largefile_CFLAGS=""
219b815c7f3Sopenharmony_ci					])
220b815c7f3Sopenharmony_ci				AS_IF([test "x$ac_cv_sys_largefile_LDFLAGS" = "xno"], [
221b815c7f3Sopenharmony_ci						ac_cv_sys_largefile_LDFLAGS=""
222b815c7f3Sopenharmony_ci					])
223b815c7f3Sopenharmony_ci				AS_IF([test "x$ac_cv_sys_largefile_LIBS" = "xno"], [
224b815c7f3Sopenharmony_ci						ac_cv_sys_largefile_LIBS=""
225b815c7f3Sopenharmony_ci					])
226b815c7f3Sopenharmony_ci
227b815c7f3Sopenharmony_ci				AC_CHECK_SIZEOF(off_t,1)
228b815c7f3Sopenharmony_ci			])
229b815c7f3Sopenharmony_ci	])
230b815c7f3Sopenharmony_ci
231b815c7f3Sopenharmony_ciAC_TYPE_SSIZE_T
232b815c7f3Sopenharmony_ci
233b815c7f3Sopenharmony_cidnl ====================================================================================
234b815c7f3Sopenharmony_cidnl  Determine endian-ness of host processor.
235b815c7f3Sopenharmony_ci
236b815c7f3Sopenharmony_ciAC_C_BIGENDIAN([
237b815c7f3Sopenharmony_ci		dnl big-endian
238b815c7f3Sopenharmony_ci		ac_cv_c_big_endian=1
239b815c7f3Sopenharmony_ci		ac_cv_c_little_endian=0
240b815c7f3Sopenharmony_ci	], [
241b815c7f3Sopenharmony_ci		dnl little-endian
242b815c7f3Sopenharmony_ci		ac_cv_c_big_endian=0
243b815c7f3Sopenharmony_ci		ac_cv_c_little_endian=1
244b815c7f3Sopenharmony_ci	])
245b815c7f3Sopenharmony_ci
246b815c7f3Sopenharmony_ciAC_DEFINE_UNQUOTED([CPU_IS_BIG_ENDIAN], [${ac_cv_c_big_endian}], [Host processor is big endian.])
247b815c7f3Sopenharmony_ciAC_DEFINE_UNQUOTED([CPU_IS_LITTLE_ENDIAN], [${ac_cv_c_little_endian}], [Host processor is little endian.])
248b815c7f3Sopenharmony_ci
249b815c7f3Sopenharmony_cidnl ====================================================================================
250b815c7f3Sopenharmony_cidnl  Check for functions.
251b815c7f3Sopenharmony_ci
252b815c7f3Sopenharmony_ciAC_CHECK_FUNCS([malloc calloc realloc free])
253b815c7f3Sopenharmony_ciAC_CHECK_FUNCS([open read write lseek lseek64])
254b815c7f3Sopenharmony_ciAC_CHECK_FUNCS([fstat fstat64 ftruncate fsync])
255b815c7f3Sopenharmony_ciAC_CHECK_FUNCS([snprintf vsnprintf])
256b815c7f3Sopenharmony_ciAC_CHECK_FUNCS([gmtime gmtime_r localtime localtime_r gettimeofday])
257b815c7f3Sopenharmony_ciAC_CHECK_FUNCS([mmap getpagesize])
258b815c7f3Sopenharmony_ciAC_CHECK_FUNCS([setlocale])
259b815c7f3Sopenharmony_ciAC_CHECK_FUNCS([pipe waitpid])
260b815c7f3Sopenharmony_ci
261b815c7f3Sopenharmony_ciAC_SEARCH_LIBS([floor], [m], [], [
262b815c7f3Sopenharmony_ci		AC_MSG_ERROR([unable to find the floor() function!])
263b815c7f3Sopenharmony_ci	])
264b815c7f3Sopenharmony_ciAC_CHECK_FUNCS([floor ceil fmod lrint lrintf])
265b815c7f3Sopenharmony_ci
266b815c7f3Sopenharmony_cidnl ====================================================================================
267b815c7f3Sopenharmony_cidnl  Check for requirements for building plugins for other languages/enviroments.
268b815c7f3Sopenharmony_ci
269b815c7f3Sopenharmony_cidnl Octave maths environment http://www.octave.org/
270b815c7f3Sopenharmony_ciAS_IF([test "x$cross_compiling" = "xno"], [
271b815c7f3Sopenharmony_ci		AS_IF([test "x$enable_octave" = "xno"], [
272b815c7f3Sopenharmony_ci				AM_CONDITIONAL(BUILD_OCTAVE_MOD, false)
273b815c7f3Sopenharmony_ci			], [
274b815c7f3Sopenharmony_ci				AC_OCTAVE_BUILD
275b815c7f3Sopenharmony_ci			])
276b815c7f3Sopenharmony_ci	], [
277b815c7f3Sopenharmony_ci		AM_CONDITIONAL(BUILD_OCTAVE_MOD, false)
278b815c7f3Sopenharmony_ci	])
279b815c7f3Sopenharmony_ci
280b815c7f3Sopenharmony_cidnl ====================================================================================
281b815c7f3Sopenharmony_cidnl  Check for Ogg, Vorbis and FLAC.
282b815c7f3Sopenharmony_ci
283b815c7f3Sopenharmony_ciHAVE_EXTERNAL_XIPH_LIBS=0
284b815c7f3Sopenharmony_ciEXTERNAL_XIPH_CFLAGS=""
285b815c7f3Sopenharmony_ciEXTERNAL_XIPH_LIBS=""
286b815c7f3Sopenharmony_ciEXTERNAL_XIPH_REQUIRE=""
287b815c7f3Sopenharmony_ci
288b815c7f3Sopenharmony_cidnl Check for pkg-config outside the if statement.
289b815c7f3Sopenharmony_ciPKG_PROG_PKG_CONFIG
290b815c7f3Sopenharmony_ciAX_REQUIRE_DEFINED([PKG_INSTALLDIR])
291b815c7f3Sopenharmony_ciPKG_INSTALLDIR
292b815c7f3Sopenharmony_ci
293b815c7f3Sopenharmony_ciAS_IF([test -n "$PKG_CONFIG"], [
294b815c7f3Sopenharmony_ci		AS_IF([test "x$enable_external_libs" = "xno"], [
295b815c7f3Sopenharmony_ci				AC_MSG_WARN([[*** External libs (FLAC, Ogg, Vorbis) disabled. ***]])
296b815c7f3Sopenharmony_ci			], [
297b815c7f3Sopenharmony_ci				PKG_CHECK_MOD_VERSION(FLAC, flac >= 1.3.1, ac_cv_flac=yes, ac_cv_flac=no)
298b815c7f3Sopenharmony_ci
299b815c7f3Sopenharmony_ci				dnl Make sure the FLAC_CFLAGS value is sane.
300b815c7f3Sopenharmony_ci				FLAC_CFLAGS=`echo $FLAC_CFLAGS | $SED "s|include/FLAC|include|"`
301b815c7f3Sopenharmony_ci
302b815c7f3Sopenharmony_ci				PKG_CHECK_MOD_VERSION(OGG, ogg >= 1.3.0, ac_cv_ogg=yes, ac_cv_ogg=no)
303b815c7f3Sopenharmony_ci
304b815c7f3Sopenharmony_ci				AS_IF([test "x$enable_experimental" = "xyes"], [
305b815c7f3Sopenharmony_ci						PKG_CHECK_MOD_VERSION(SPEEX, speex >= 1.2, ac_cv_speex=yes, ac_cv_speex=no)
306b815c7f3Sopenharmony_ci					], [
307b815c7f3Sopenharmony_ci						SPEEX_CFLAGS=""
308b815c7f3Sopenharmony_ci						SPEEX_LIBS=""
309b815c7f3Sopenharmony_ci					])
310b815c7f3Sopenharmony_ci
311b815c7f3Sopenharmony_ci				dnl Vorbis versions earlier than 1.2.3 have bugs that cause the libsndfile
312b815c7f3Sopenharmony_ci				dnl test suite to fail on MIPS, PowerPC and others.
313b815c7f3Sopenharmony_ci				dnl See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=549899
314b815c7f3Sopenharmony_ci				PKG_CHECK_MOD_VERSION(VORBIS, vorbis >= 1.2.3, ac_cv_vorbis=yes, ac_cv_vorbis=no)
315b815c7f3Sopenharmony_ci				PKG_CHECK_MOD_VERSION(VORBISENC, vorbisenc >= 1.2.3, ac_cv_vorbisenc=yes, ac_cv_vorbisenc=no)
316b815c7f3Sopenharmony_ci
317b815c7f3Sopenharmony_ci				PKG_CHECK_MOD_VERSION(OPUS, opus >= 1.1, ac_cv_opus=yes, ac_cv_opus=no)
318b815c7f3Sopenharmony_ci				enable_external_libs=yes
319b815c7f3Sopenharmony_ci			])
320b815c7f3Sopenharmony_ci
321b815c7f3Sopenharmony_ci			AS_IF([test "x$ac_cv_flac$ac_cv_ogg$ac_cv_vorbis$ac_cv_vorbisenc$ac_cv_opus" = "xyesyesyesyesyes"], [
322b815c7f3Sopenharmony_ci					HAVE_EXTERNAL_XIPH_LIBS=1
323b815c7f3Sopenharmony_ci					enable_external_libs=yes
324b815c7f3Sopenharmony_ci
325b815c7f3Sopenharmony_ci					EXTERNAL_XIPH_CFLAGS="$FLAC_CFLAGS $VORBIS_CFLAGS $VORBISENC_CFLAGS $SPEEX_CFLAGS $OPUS_CFLAGS $OGG_CFLAGS "
326b815c7f3Sopenharmony_ci					EXTERNAL_XIPH_LIBS="$FLAC_LIBS $VORBIS_LIBS $VORBISENC_LIBS $SPEEX_LIBS $OPUS_LIBS $OGG_LIBS "
327b815c7f3Sopenharmony_ci					EXTERNAL_XIPH_REQUIRE="flac ogg vorbis vorbisenc opus"
328b815c7f3Sopenharmony_ci
329b815c7f3Sopenharmony_ci					if test x$ac_cv_speex = "xyes" ; then
330b815c7f3Sopenharmony_ci						EXTERNAL_XIPH_REQUIRE="$EXTERNAL_XIPH_REQUIRE speex"
331b815c7f3Sopenharmony_ci					fi
332b815c7f3Sopenharmony_ci				], [
333b815c7f3Sopenharmony_ci					AS_ECHO([""])
334b815c7f3Sopenharmony_ci					AC_MSG_WARN([[*** One or more of the external libraries (ie libflac, libogg,]])
335b815c7f3Sopenharmony_ci					AC_MSG_WARN([[*** libvorbis and libopus) is either missing (possibly only the development]])
336b815c7f3Sopenharmony_ci					AC_MSG_WARN([[*** headers) or is of an unsupported version.]])
337b815c7f3Sopenharmony_ci					AC_MSG_WARN([[***]])
338b815c7f3Sopenharmony_ci					AC_MSG_WARN([[*** Unfortunately, for ease of maintenance, the external libs]])
339b815c7f3Sopenharmony_ci					AC_MSG_WARN([[*** are an all or nothing affair.]])
340b815c7f3Sopenharmony_ci					AS_ECHO([""])
341b815c7f3Sopenharmony_ci					enable_external_libs=no
342b815c7f3Sopenharmony_ci				])
343b815c7f3Sopenharmony_ci	])
344b815c7f3Sopenharmony_ci
345b815c7f3Sopenharmony_ciAC_DEFINE_UNQUOTED([HAVE_EXTERNAL_XIPH_LIBS], [$HAVE_EXTERNAL_XIPH_LIBS], [Will be set to 1 if flac, ogg, vorbis, and opus are available.])
346b815c7f3Sopenharmony_ci
347b815c7f3Sopenharmony_cidnl ====================================================================================
348b815c7f3Sopenharmony_cidnl  Check for MPEG libraris liblame
349b815c7f3Sopenharmony_ci
350b815c7f3Sopenharmony_ciac_cv_lame="no"
351b815c7f3Sopenharmony_ciac_cv_mpg123="no"
352b815c7f3Sopenharmony_ciHAVE_MPEG=0
353b815c7f3Sopenharmony_ciEXTERNAL_MPEG_REQUIRE=""
354b815c7f3Sopenharmony_ciEXTERNAL_MPEG_LIBS=""
355b815c7f3Sopenharmony_ci
356b815c7f3Sopenharmony_ciAS_IF([test -n "$PKG_CONFIG"], [
357b815c7f3Sopenharmony_ci		AS_IF([test "x$enable_mpeg" = "xno"], [
358b815c7f3Sopenharmony_ci				AC_MSG_WARN([[*** MPEG (Lame/MPG123) disabled. ***]])
359b815c7f3Sopenharmony_ci			], [
360b815c7f3Sopenharmony_ci				AC_CHECK_HEADER(lame/lame.h,
361b815c7f3Sopenharmony_ci								lame_header_found="yes",
362b815c7f3Sopenharmony_ci								lame_header_found="no")
363b815c7f3Sopenharmony_ci				AC_SEARCH_LIBS(lame_set_VBR_q, [lame mp3lame], [lame_lib_found="yes"], [lame_lib_found="no"])
364b815c7f3Sopenharmony_ci				AS_IF([test "x$lame_lib_found$lame_header_found" = "xyesyes"], [
365b815c7f3Sopenharmony_ci						ac_cv_lame="yes"
366b815c7f3Sopenharmony_ci					], [
367b815c7f3Sopenharmony_ci						AC_MSG_WARN([["MPEG support selected but external Lame library cannot be found.]])
368b815c7f3Sopenharmony_ci					])
369b815c7f3Sopenharmony_ci
370b815c7f3Sopenharmony_ci				PKG_CHECK_MOD_VERSION([MPG123], [libmpg123 >= 1.25.10], [
371b815c7f3Sopenharmony_ci						ac_cv_mpg123="yes"
372b815c7f3Sopenharmony_ci					], [
373b815c7f3Sopenharmony_ci						AC_MSG_WARN([["MPEG support selected but external MPG123 library cannot be found.]])
374b815c7f3Sopenharmony_ci					])
375b815c7f3Sopenharmony_ci
376b815c7f3Sopenharmony_ci				AS_IF([test "x$ac_cv_lame$ac_cv_mpg123" = "xyesyes"], [
377b815c7f3Sopenharmony_ci						enable_mpeg="yes"
378b815c7f3Sopenharmony_ci						HAVE_MPEG=1
379b815c7f3Sopenharmony_ci						EXTERNAL_MPEG_REQUIRE="libmpg123"
380b815c7f3Sopenharmony_ci						EXTERNAL_MPEG_LIBS="-lmp3lame"
381b815c7f3Sopenharmony_ci						MPEG_CFLAGS="$MPG123_CFLAGS"
382b815c7f3Sopenharmony_ci						MPEG_LIBS="$MPG123_LIBS"
383b815c7f3Sopenharmony_ci					], [
384b815c7f3Sopenharmony_ci						enable_mpeg="no"
385b815c7f3Sopenharmony_ci						AS_ECHO([""])
386b815c7f3Sopenharmony_ci						AC_MSG_WARN([[*** MPEG support disabled.]])
387b815c7f3Sopenharmony_ci						AS_ECHO([""])
388b815c7f3Sopenharmony_ci					])
389b815c7f3Sopenharmony_ci			])
390b815c7f3Sopenharmony_ci	])
391b815c7f3Sopenharmony_ci
392b815c7f3Sopenharmony_ciAC_DEFINE_UNQUOTED([HAVE_MPEG], [$HAVE_MPEG], [Will be set to 1 if lame, mpg123 mpeg support is available.])
393b815c7f3Sopenharmony_ci
394b815c7f3Sopenharmony_cidnl ====================================================================================
395b815c7f3Sopenharmony_cidnl  Check for libsqlite3 (only used in regtest).
396b815c7f3Sopenharmony_ci
397b815c7f3Sopenharmony_ciac_cv_sqlite3=0
398b815c7f3Sopenharmony_ciAS_IF([test "x$enable_sqlite" != "xno"], [
399b815c7f3Sopenharmony_ci		PKG_CHECK_MOD_VERSION([SQLITE3], [sqlite3 >= 3.2], [ac_cv_sqlite3=1], [ac_cv_sqlite3=0])
400b815c7f3Sopenharmony_ci	])
401b815c7f3Sopenharmony_ci
402b815c7f3Sopenharmony_ciAC_DEFINE_UNQUOTED([HAVE_SQLITE3], [${ac_cv_sqlite3}], [Set to 1 if you have libsqlite3.])
403b815c7f3Sopenharmony_ciAM_CONDITIONAL([HAVE_SQLITE3], [test "x$ac_cv_sqlite3" = "x1"])
404b815c7f3Sopenharmony_ci
405b815c7f3Sopenharmony_cidnl ====================================================================================
406b815c7f3Sopenharmony_cidnl  Determine if the processor can do clipping on float to int conversions.
407b815c7f3Sopenharmony_ci
408b815c7f3Sopenharmony_ciAS_IF([test "x$enable_cpu_clip" != "xno"], [
409b815c7f3Sopenharmony_ci		MN_C_CLIP_MODE
410b815c7f3Sopenharmony_ci	], [
411b815c7f3Sopenharmony_ci		AS_ECHO(["checking processor clipping capabilities... disabled"])
412b815c7f3Sopenharmony_ci		ac_cv_c_clip_positive=0
413b815c7f3Sopenharmony_ci		ac_cv_c_clip_negative=0
414b815c7f3Sopenharmony_ci	])
415b815c7f3Sopenharmony_ci
416b815c7f3Sopenharmony_ciAC_DEFINE_UNQUOTED([CPU_CLIPS_POSITIVE], [${ac_cv_c_clip_positive}],
417b815c7f3Sopenharmony_ci	[Host processor clips on positive float to int conversion.])
418b815c7f3Sopenharmony_ciAC_DEFINE_UNQUOTED([CPU_CLIPS_NEGATIVE], [${ac_cv_c_clip_negative}],
419b815c7f3Sopenharmony_ci	[Host processor clips on negative float to int conversion.])
420b815c7f3Sopenharmony_ci
421b815c7f3Sopenharmony_cidnl ====================================================================================
422b815c7f3Sopenharmony_cidnl  Host OS specific stuff.
423b815c7f3Sopenharmony_ci
424b815c7f3Sopenharmony_ciOS_SPECIFIC_CFLAGS=""
425b815c7f3Sopenharmony_ciOS_SPECIFIC_LINKS=""
426b815c7f3Sopenharmony_cios_is_win32=0
427b815c7f3Sopenharmony_cios_is_openbsd=0
428b815c7f3Sopenharmony_ciuse_windows_api=0
429b815c7f3Sopenharmony_ciAS_CASE([$host_os],
430b815c7f3Sopenharmony_ci	[darwin* | rhapsody*], [
431b815c7f3Sopenharmony_ci		AS_IF([test "x$HAVE_XCODE_SELECT" = "xyes"], [
432b815c7f3Sopenharmony_ci				developer_path=`xcode-select --print-path`
433b815c7f3Sopenharmony_ci			], [
434b815c7f3Sopenharmony_ci				developer_path="/Developer"
435b815c7f3Sopenharmony_ci			])
436b815c7f3Sopenharmony_ci		OS_SPECIFIC_LINKS="-framework CoreAudio -framework AudioToolbox -framework CoreFoundation"],
437b815c7f3Sopenharmony_ci	[mingw*], [
438b815c7f3Sopenharmony_ci		os_is_win32=1
439b815c7f3Sopenharmony_ci		use_windows_api=1
440b815c7f3Sopenharmony_ci		OS_SPECIFIC_LINKS="-lwinmm"],
441b815c7f3Sopenharmony_ci	[openbsd*], [
442b815c7f3Sopenharmony_ci		os_is_openbsd=1
443b815c7f3Sopenharmony_ci	])
444b815c7f3Sopenharmony_ci
445b815c7f3Sopenharmony_ciAC_DEFINE_UNQUOTED([OS_IS_WIN32], [${os_is_win32}], [Set to 1 if compiling for Win32])
446b815c7f3Sopenharmony_ciAC_DEFINE_UNQUOTED([OS_IS_OPENBSD], [${os_is_openbsd}], [Set to 1 if compiling for OpenBSD])
447b815c7f3Sopenharmony_ciAC_DEFINE_UNQUOTED([USE_WINDOWS_API], [${use_windows_api}], [Set to 1 to use the native windows API])
448b815c7f3Sopenharmony_ciAM_CONDITIONAL(USE_WIN_VERSION_FILE, test ${use_windows_api} -eq 1)
449b815c7f3Sopenharmony_ci
450b815c7f3Sopenharmony_cidnl ====================================================================================
451b815c7f3Sopenharmony_cidnl  Check for ALSA.
452b815c7f3Sopenharmony_ci
453b815c7f3Sopenharmony_ciAS_IF([test "x$enable_alsa" != "xno"], [
454b815c7f3Sopenharmony_ci		PKG_CHECK_MODULES([ALSA], [alsa], [
455b815c7f3Sopenharmony_ci				dnl actually test whether ALSA really works, in
456b815c7f3Sopenharmony_ci				dnl order to dodge wrong cross-compilation pickups
457b815c7f3Sopenharmony_ci				save_CFLAGS="${CFLAGS}"
458b815c7f3Sopenharmony_ci				save_LIBS="${LIBS}"
459b815c7f3Sopenharmony_ci				CFLAGS="${CFLAGS} ${ALSA_CFLAGS}"
460b815c7f3Sopenharmony_ci				LIBS="${LIBS} ${ALSA_LIBS}"
461b815c7f3Sopenharmony_ci				AC_CHECK_HEADERS([alsa/asoundlib.h])
462b815c7f3Sopenharmony_ci				AS_IF([test "x$ac_cv_header_alsa_asoundlib_h" = "xyes"], [
463b815c7f3Sopenharmony_ci						dnl ALSA definitely works
464b815c7f3Sopenharmony_ci						AC_DEFINE([HAVE_ALSA], [1], [Set to 1 if you have alsa])
465b815c7f3Sopenharmony_ci						alsa_works="yes"
466b815c7f3Sopenharmony_ci					], [
467b815c7f3Sopenharmony_ci						dnl picked up wrong ALSA
468b815c7f3Sopenharmony_ci						alsa_works="no"
469b815c7f3Sopenharmony_ci
470b815c7f3Sopenharmony_ci						dnl reset flags
471b815c7f3Sopenharmony_ci						ALSA_CFLAGS=""
472b815c7f3Sopenharmony_ci						ALSA_LIBS=""
473b815c7f3Sopenharmony_ci					])
474b815c7f3Sopenharmony_ci				CFLAGS="${save_CFLAGS}"
475b815c7f3Sopenharmony_ci				LIBS="${save_LIBS}"
476b815c7f3Sopenharmony_ci			], [
477b815c7f3Sopenharmony_ci				dnl could not find ALSA
478b815c7f3Sopenharmony_ci				alsa_works="no"
479b815c7f3Sopenharmony_ci			])
480b815c7f3Sopenharmony_ci
481b815c7f3Sopenharmony_ci		AS_IF([test "x$alsa_works" = "xno"], [
482b815c7f3Sopenharmony_ci				AS_IF([test "x$enable_alsa" = "xyes"], [
483b815c7f3Sopenharmony_ci						dnl explicitly passed --enable-alsa, hence error out loud and clearly
484b815c7f3Sopenharmony_ci						AC_MSG_ERROR([You explicitly requested alsa support, but alsa could not be found!])
485b815c7f3Sopenharmony_ci					], [
486b815c7f3Sopenharmony_ci						dnl did not explicitly pass --enable-alsa, relying on default automagic on
487b815c7f3Sopenharmony_ci						enable_alsa="no (auto)"
488b815c7f3Sopenharmony_ci					])
489b815c7f3Sopenharmony_ci			])
490b815c7f3Sopenharmony_ci	])
491b815c7f3Sopenharmony_ci
492b815c7f3Sopenharmony_cidnl ====================================================================================
493b815c7f3Sopenharmony_cidnl  Check for OpenBSD's sndio.
494b815c7f3Sopenharmony_ci
495b815c7f3Sopenharmony_ciSNDIO_LIBS=""
496b815c7f3Sopenharmony_ciHAVE_SNDIO_H=0
497b815c7f3Sopenharmony_ciAS_CASE([$host_os],
498b815c7f3Sopenharmony_ci	[openbsd*], [
499b815c7f3Sopenharmony_ci		AC_CHECK_HEADERS(sndio.h)
500b815c7f3Sopenharmony_ci		AS_IF([test "x$ac_cv_header_sndio_h" = "xyes"], [
501b815c7f3Sopenharmony_ci				SNDIO_LIBS="-lsndio"
502b815c7f3Sopenharmony_ci				HAVE_SNDIO_H=1
503b815c7f3Sopenharmony_ci			])
504b815c7f3Sopenharmony_ci	])
505b815c7f3Sopenharmony_ci
506b815c7f3Sopenharmony_ciAC_DEFINE_UNQUOTED([HAVE_SNDIO_H], [${HAVE_SNDIO_H}], [Set to 1 if <sndio.h> is available.])
507b815c7f3Sopenharmony_ci
508b815c7f3Sopenharmony_cidnl ====================================================================================
509b815c7f3Sopenharmony_cidnl  Test for sanity when cross-compiling.
510b815c7f3Sopenharmony_ci
511b815c7f3Sopenharmony_ciAS_IF([test "x$ac_cv_sizeof_short" != "x2"], [
512b815c7f3Sopenharmony_ci		AC_MSG_WARN([[******************************************************************]])
513b815c7f3Sopenharmony_ci		AC_MSG_WARN([[*** sizeof (short) != 2.                                          ]])
514b815c7f3Sopenharmony_ci		AC_MSG_WARN([[******************************************************************]])
515b815c7f3Sopenharmony_ci	])
516b815c7f3Sopenharmony_ci
517b815c7f3Sopenharmony_ciAS_IF([test "x$ac_cv_sizeof_int" != "x4"], [
518b815c7f3Sopenharmony_ci		AC_MSG_WARN([[******************************************************************]])
519b815c7f3Sopenharmony_ci		AC_MSG_WARN([[*** sizeof (int) != 4                                             ]])
520b815c7f3Sopenharmony_ci		AC_MSG_WARN([[******************************************************************]])
521b815c7f3Sopenharmony_ci	])
522b815c7f3Sopenharmony_ci
523b815c7f3Sopenharmony_ciAS_IF([test "x$ac_cv_sizeof_float" != "x4"], [
524b815c7f3Sopenharmony_ci		AC_MSG_WARN([[******************************************************************]])
525b815c7f3Sopenharmony_ci		AC_MSG_WARN([[*** sizeof (float) != 4.                                          ]])
526b815c7f3Sopenharmony_ci		AC_MSG_WARN([[******************************************************************]])
527b815c7f3Sopenharmony_ci	])
528b815c7f3Sopenharmony_ci
529b815c7f3Sopenharmony_ciAS_IF([test "x$ac_cv_sizeof_double" != "x8"], [
530b815c7f3Sopenharmony_ci		AC_MSG_WARN([[******************************************************************]])
531b815c7f3Sopenharmony_ci		AC_MSG_WARN([[*** sizeof (double) != 8.                                         ]])
532b815c7f3Sopenharmony_ci		AC_MSG_WARN([[******************************************************************]])
533b815c7f3Sopenharmony_ci	])
534b815c7f3Sopenharmony_ci
535b815c7f3Sopenharmony_ciAS_IF([test "x$ac_cv_prog_HAVE_AUTOGEN" = "xno"], [
536b815c7f3Sopenharmony_ci		AC_MSG_WARN([[Touching files in directory tests/.]])
537b815c7f3Sopenharmony_ci		touch tests/*.c tests/*.h
538b815c7f3Sopenharmony_ci	])
539b815c7f3Sopenharmony_ci
540b815c7f3Sopenharmony_cidnl ====================================================================================
541b815c7f3Sopenharmony_cidnl  Settings for the HTML documentation.
542b815c7f3Sopenharmony_ci
543b815c7f3Sopenharmony_ciAS_IF([test "x$enable_bow_docs" = "xyes"], [
544b815c7f3Sopenharmony_ci		HTML_BGCOLOUR="white"
545b815c7f3Sopenharmony_ci		HTML_FGCOLOUR="black"
546b815c7f3Sopenharmony_ci	], [
547b815c7f3Sopenharmony_ci		HTML_BGCOLOUR="black"
548b815c7f3Sopenharmony_ci		HTML_FGCOLOUR="white"
549b815c7f3Sopenharmony_ci	])
550b815c7f3Sopenharmony_ci
551b815c7f3Sopenharmony_cidnl ====================================================================================
552b815c7f3Sopenharmony_cidnl  Now use the information from the checking stage.
553b815c7f3Sopenharmony_ci
554b815c7f3Sopenharmony_ciwin32_target_dll=0
555b815c7f3Sopenharmony_ciCOMPILER_IS_GCC=0
556b815c7f3Sopenharmony_ci
557b815c7f3Sopenharmony_ciAS_IF([test "x$enable_flags_setting" = "xyes"], [
558b815c7f3Sopenharmony_ci		AX_APPEND_COMPILE_FLAGS([-O2 -pipe], [CFLAGS])
559b815c7f3Sopenharmony_ci
560b815c7f3Sopenharmony_ci		AC_LANG_PUSH([C++])
561b815c7f3Sopenharmony_ci		AX_APPEND_COMPILE_FLAGS([-O2 -pipe], [CXXFLAGS])
562b815c7f3Sopenharmony_ci		AC_LANG_POP([C++])
563b815c7f3Sopenharmony_ci
564b815c7f3Sopenharmony_ci		AS_CASE([${host_os}],
565b815c7f3Sopenharmony_ci			[darwin*], [
566b815c7f3Sopenharmony_ci				ldflags_test="-Wl,-dead_strip_dylibs"],
567b815c7f3Sopenharmony_ci			[linux*], [
568b815c7f3Sopenharmony_ci				ldflags_test="-Wl,-O1 -Wl,--as-needed -Wl,--no-undefined -Wl,--gc-sections"]
569b815c7f3Sopenharmony_ci			)
570b815c7f3Sopenharmony_ci		AX_APPEND_LINK_FLAGS([${ldflags_test}], [LDFLAGS])
571b815c7f3Sopenharmony_ci	])
572b815c7f3Sopenharmony_ci
573b815c7f3Sopenharmony_ciAS_IF([test "x$enable_werror" = "xyes"], [
574b815c7f3Sopenharmony_ci		AX_APPEND_COMPILE_FLAGS([-Werror], [CFLAGS])
575b815c7f3Sopenharmony_ci
576b815c7f3Sopenharmony_ci		AC_LANG_PUSH([C++])
577b815c7f3Sopenharmony_ci		AX_APPEND_COMPILE_FLAGS([-Werror], [CXXFLAGS])
578b815c7f3Sopenharmony_ci		AC_LANG_POP([C++])
579b815c7f3Sopenharmony_ci	])
580b815c7f3Sopenharmony_ci
581b815c7f3Sopenharmony_cicommon_flags="-Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wundef -Wuninitialized -Winit-self"
582b815c7f3Sopenharmony_cicommon_cflags="${common_flags}"
583b815c7f3Sopenharmony_cidnl Clang doesn't know about -Wno-format-truncation
584b815c7f3Sopenharmony_cidnl and would spew tons of warnings otherwise.
585b815c7f3Sopenharmony_ciAS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [
586b815c7f3Sopenharmony_ci		common_cflags+=" -Wno-format-truncation"
587b815c7f3Sopenharmony_ci	])
588b815c7f3Sopenharmony_cicommon_cxxflags="${common_flags}"
589b815c7f3Sopenharmony_ciAS_IF([test "x$ax_cv_cxx_compiler_vendor" = "xgnu"], [
590b815c7f3Sopenharmony_ci		common_cxxflags+=" -Wno-format-truncation"
591b815c7f3Sopenharmony_ci	])
592b815c7f3Sopenharmony_ci
593b815c7f3Sopenharmony_ciAX_APPEND_COMPILE_FLAGS([${common_cflags} -Wvla -Wbad-function-cast -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Waggregate-return], [CFLAGS])
594b815c7f3Sopenharmony_ci
595b815c7f3Sopenharmony_ciAC_LANG_PUSH([C++])
596b815c7f3Sopenharmony_ciAX_APPEND_COMPILE_FLAGS([${common_cxxflags} -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wreorder -Wsign-promo], [CXXFLAGS])
597b815c7f3Sopenharmony_ciAC_LANG_POP([C++])
598b815c7f3Sopenharmony_ci
599b815c7f3Sopenharmony_ciAS_IF([test "x$enable_test_coverage" = "xyes"], [
600b815c7f3Sopenharmony_ci		AX_APPEND_COMPILE_FLAGS([-coverage], [CFLAGS])
601b815c7f3Sopenharmony_ci	])
602b815c7f3Sopenharmony_ci
603b815c7f3Sopenharmony_cidnl some distributions (such as Gentoo) have _FORTIFY_SOURCE always
604b815c7f3Sopenharmony_cidnl enabled. We test for this situation in order to prevent polluting
605b815c7f3Sopenharmony_cidnl the console with messages of macro redefinitions.
606b815c7f3Sopenharmony_ciAX_ADD_FORTIFY_SOURCE
607b815c7f3Sopenharmony_ci
608b815c7f3Sopenharmony_ciAS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [
609b815c7f3Sopenharmony_ci		dnl OS specific tweaks.
610b815c7f3Sopenharmony_ci		AS_CASE([$host_os],
611b815c7f3Sopenharmony_ci			[darwin* | rhapsody*], [
612b815c7f3Sopenharmony_ci				dnl Disable -Wall, -pedantic and -Wshadow for Apple Darwin/Rhapsody.
613b815c7f3Sopenharmony_ci				dnl System headers on these systems are broken.
614b815c7f3Sopenharmony_ci				temp_CFLAGS=`echo $CFLAGS | $SED "s/-Wall -pedantic//" | $SED "s/-Wshadow//" | $SED "s/-Waggregate-return//"`
615b815c7f3Sopenharmony_ci				CFLAGS=$temp_CFLAGS
616b815c7f3Sopenharmony_ci				SHLIB_VERSION_ARG="-Wl,-exported_symbols_list -Wl,\$(top_srcdir)/src/Symbols.darwin"],
617b815c7f3Sopenharmony_ci			[mingw*], [
618b815c7f3Sopenharmony_ci				SHLIB_VERSION_ARG="-Wc,-static-libgcc -Wl,\$(top_srcdir)/src/libsndfile-1.def"
619b815c7f3Sopenharmony_ci				win32_target_dll=1
620b815c7f3Sopenharmony_ci				AS_IF([test "x$enable_shared" = "xno"], [
621b815c7f3Sopenharmony_ci						win32_target_dll=0
622b815c7f3Sopenharmony_ci					])
623b815c7f3Sopenharmony_ci				AX_APPEND_COMPILE_FLAGS([-mstackrealign], [CFLAGS])
624b815c7f3Sopenharmony_ci				],
625b815c7f3Sopenharmony_ci			[os2*], [
626b815c7f3Sopenharmony_ci				SHLIB_VERSION_ARG="-Wl,-export-symbols \$(top_srcdir)/src/Symbols.os2"
627b815c7f3Sopenharmony_ci			])
628b815c7f3Sopenharmony_ci
629b815c7f3Sopenharmony_ci		COMPILER_IS_GCC=1
630b815c7f3Sopenharmony_ci	])
631b815c7f3Sopenharmony_ci
632b815c7f3Sopenharmony_ciAS_CASE([$host_os], [linux*|kfreebsd*-gnu*|gnu*],  [SHLIB_VERSION_ARG="-Wl,--version-script=\$(top_srcdir)/src/Symbols.gnu-binutils"])
633b815c7f3Sopenharmony_ci
634b815c7f3Sopenharmony_ciAC_DEFINE_UNQUOTED([WIN32_TARGET_DLL], [${win32_target_dll}], [Set to 1 if windows DLL is being built.])
635b815c7f3Sopenharmony_ciAC_DEFINE_UNQUOTED([COMPILER_IS_GCC], [${COMPILER_IS_GCC}], [Set to 1 if the compile is GNU GCC.])
636b815c7f3Sopenharmony_ci
637b815c7f3Sopenharmony_ciCFLAGS="$CFLAGS $OS_SPECIFIC_CFLAGS"
638b815c7f3Sopenharmony_ci
639b815c7f3Sopenharmony_ciAS_IF([test "x$CFLAGS" = "x"], [
640b815c7f3Sopenharmony_ci		AC_MSG_ERROR(["Error in configure script. CFLAGS has been screwed up."])
641b815c7f3Sopenharmony_ci	])
642b815c7f3Sopenharmony_ci
643b815c7f3Sopenharmony_ciHOST_TRIPLET="${host_cpu}-${host_vendor}-${host_os}"
644b815c7f3Sopenharmony_ci
645b815c7f3Sopenharmony_ciAC_DEFINE_UNQUOTED([HOST_TRIPLET], [${HOST_TRIPLET}], [The host triplet of the compiled binary.])
646b815c7f3Sopenharmony_ci
647b815c7f3Sopenharmony_ciAS_IF([test "$HOST_TRIPLET" = "x86_64-w64-mingw32"], [
648b815c7f3Sopenharmony_ci		OS_SPECIFIC_LINKS=" -static-libgcc $OS_SPECIFIC_LINKS"
649b815c7f3Sopenharmony_ci	])
650b815c7f3Sopenharmony_ci
651b815c7f3Sopenharmony_ciWIN_RC_VERSION=`echo $PACKAGE_VERSION | $SED -e "s/pre.*//" -e "s/beta.*//" -e "s/\./,/g"`
652b815c7f3Sopenharmony_ci
653b815c7f3Sopenharmony_ci
654b815c7f3Sopenharmony_ciAS_IF([test "x$enable_static" = "xno"], [
655b815c7f3Sopenharmony_ci		SRC_BINDIR=src/.libs/
656b815c7f3Sopenharmony_ci		TEST_BINDIR=tests/.libs/
657b815c7f3Sopenharmony_ci	], [
658b815c7f3Sopenharmony_ci		SRC_BINDIR=src/
659b815c7f3Sopenharmony_ci		TEST_BINDIR=tests/
660b815c7f3Sopenharmony_ci	])
661b815c7f3Sopenharmony_ci
662b815c7f3Sopenharmony_cidnl -------------------------------------------------------------------------------
663b815c7f3Sopenharmony_ci
664b815c7f3Sopenharmony_ciAC_SUBST(HOST_TRIPLET)
665b815c7f3Sopenharmony_ci
666b815c7f3Sopenharmony_ciAC_SUBST(HTML_BGCOLOUR)
667b815c7f3Sopenharmony_ciAC_SUBST(HTML_FGCOLOUR)
668b815c7f3Sopenharmony_ci
669b815c7f3Sopenharmony_ciAC_SUBST(SHLIB_VERSION_ARG)
670b815c7f3Sopenharmony_ciAC_SUBST([SHARED_VERSION_INFO], [lt_current:lt_revision:lt_age])
671b815c7f3Sopenharmony_ciAC_SUBST([ABI_VERSION], [abi_version_major.abi_version_minor.abi_version_patch])
672b815c7f3Sopenharmony_ciAC_SUBST(CLEAN_VERSION)
673b815c7f3Sopenharmony_ciAC_SUBST(VERSION_MAJOR)
674b815c7f3Sopenharmony_ciAC_SUBST(GEN_TOOL)
675b815c7f3Sopenharmony_ci
676b815c7f3Sopenharmony_ciAC_SUBST(WIN_RC_VERSION)
677b815c7f3Sopenharmony_ci
678b815c7f3Sopenharmony_ciAC_SUBST(HAVE_EXTERNAL_XIPH_LIBS)
679b815c7f3Sopenharmony_ciAC_SUBST(HAVE_MPEG)
680b815c7f3Sopenharmony_ciAC_SUBST(OS_SPECIFIC_CFLAGS)
681b815c7f3Sopenharmony_ciAC_SUBST(OS_SPECIFIC_LINKS)
682b815c7f3Sopenharmony_ciAC_SUBST(SNDIO_LIBS)
683b815c7f3Sopenharmony_ci
684b815c7f3Sopenharmony_ciAC_SUBST(EXTERNAL_XIPH_CFLAGS)
685b815c7f3Sopenharmony_ciAC_SUBST(EXTERNAL_XIPH_LIBS)
686b815c7f3Sopenharmony_ciAC_SUBST(EXTERNAL_XIPH_REQUIRE)
687b815c7f3Sopenharmony_ciAC_SUBST(EXTERNAL_MPEG_LIBS)
688b815c7f3Sopenharmony_ciAC_SUBST(EXTERNAL_MPEG_REQUIRE)
689b815c7f3Sopenharmony_ciAC_SUBST(MPG123_CFLAGS)
690b815c7f3Sopenharmony_ciAC_SUBST(MPG123_LIBS)
691b815c7f3Sopenharmony_ciAC_SUBST(MPEG_CFLAGS)
692b815c7f3Sopenharmony_ciAC_SUBST(MPEG_LIBS)
693b815c7f3Sopenharmony_ciAC_SUBST(SRC_BINDIR)
694b815c7f3Sopenharmony_ciAC_SUBST(TEST_BINDIR)
695b815c7f3Sopenharmony_ci
696b815c7f3Sopenharmony_ciAC_CONFIG_FILES([
697b815c7f3Sopenharmony_ci	Makefile Octave/Makefile
698b815c7f3Sopenharmony_ci	src/version-metadata.rc
699b815c7f3Sopenharmony_ci	tests/test_wrapper.sh tests/pedantic-header-test.sh
700b815c7f3Sopenharmony_ci	libsndfile.spec sndfile.pc
701b815c7f3Sopenharmony_ci	Scripts/build-test-tarball.mk
702b815c7f3Sopenharmony_ci	])
703b815c7f3Sopenharmony_ciAC_OUTPUT
704b815c7f3Sopenharmony_ci
705b815c7f3Sopenharmony_cidnl ====================================================================================
706b815c7f3Sopenharmony_ci
707b815c7f3Sopenharmony_ciAS_IF([test -z "$PKG_CONFIG"], [
708b815c7f3Sopenharmony_ci		AS_ECHO(["    *****************************************************************"])
709b815c7f3Sopenharmony_ci		AS_ECHO(["    ***          The pkg-config program is missing.               ***"])
710b815c7f3Sopenharmony_ci		AS_ECHO(["    *** External FLAC/Ogg/Vorbis libs cannot be found without it. ***"])
711b815c7f3Sopenharmony_ci		AS_ECHO(["    ***       http://pkg-config.freedesktop.org/wiki/             ***"])
712b815c7f3Sopenharmony_ci		AS_ECHO(["    *****************************************************************"])
713b815c7f3Sopenharmony_ci	])
714b815c7f3Sopenharmony_ci
715b815c7f3Sopenharmony_ciAX_RECURSIVE_EVAL([$libdir], [full_absolute_libdir])
716b815c7f3Sopenharmony_ciAX_RECURSIVE_EVAL([$bindir], [full_absolute_bindir])
717b815c7f3Sopenharmony_ciAX_RECURSIVE_EVAL([$pkgconfigdir], [full_absolute_pkgconfigdir])
718b815c7f3Sopenharmony_ciAX_RECURSIVE_EVAL([$htmldir], [full_absolute_htmldir])
719b815c7f3Sopenharmony_ciAC_MSG_RESULT([
720b815c7f3Sopenharmony_ci-=-=-=-=-=-=-=-=-=-= Configuration Complete =-=-=-=-=-=-=-=-=-=-=-
721b815c7f3Sopenharmony_ci
722b815c7f3Sopenharmony_ci  Configuration summary :
723b815c7f3Sopenharmony_ci
724b815c7f3Sopenharmony_ci    libsndfile version : .................. ${VERSION}
725b815c7f3Sopenharmony_ci
726b815c7f3Sopenharmony_ci    Host CPU : ............................ ${host_cpu}
727b815c7f3Sopenharmony_ci    Host Vendor : ......................... ${host_vendor}
728b815c7f3Sopenharmony_ci    Host OS : ............................. ${host_os}
729b815c7f3Sopenharmony_ci
730b815c7f3Sopenharmony_ci    CFLAGS : .............................. ${CFLAGS}
731b815c7f3Sopenharmony_ci    CXXFLAGS : ............................ ${CXXFLAGS}
732b815c7f3Sopenharmony_ci    CPPFLAGS : ............................ ${CPPFLAGS}
733b815c7f3Sopenharmony_ci    LDFLAGS : ............................. ${LDFLAGS}
734b815c7f3Sopenharmony_ci
735b815c7f3Sopenharmony_ci    Experimental code : ................... ${enable_experimental:-no}
736b815c7f3Sopenharmony_ci    Using ALSA in example programs : ...... ${enable_alsa:-no}
737b815c7f3Sopenharmony_ci    External FLAC/Ogg/Vorbis/Opus : ....... ${enable_external_libs:-no}
738b815c7f3Sopenharmony_ci    External MPEG Lame/MPG123 : ........... ${enable_mpeg:-no}
739b815c7f3Sopenharmony_ci    Building Octave interface : ........... ${OCTAVE_BUILD}
740b815c7f3Sopenharmony_ci
741b815c7f3Sopenharmony_ci  Tools :
742b815c7f3Sopenharmony_ci
743b815c7f3Sopenharmony_ci    C Compiler Vendor is : ................ ${ax_cv_c_compiler_vendor} (${ax_cv_c_compiler_version})
744b815c7f3Sopenharmony_ci    CXX Compiler Vendor is : .............. ${ax_cv_cxx_compiler_vendor} (${ax_cv_cxx_compiler_version})
745b815c7f3Sopenharmony_ci
746b815c7f3Sopenharmony_ci    Sanitizer enabled : ................... ${enable_sanitizer:-no}
747b815c7f3Sopenharmony_ci
748b815c7f3Sopenharmony_ci  Installation directories :
749b815c7f3Sopenharmony_ci
750b815c7f3Sopenharmony_ci    Library directory : ................... ${full_absolute_libdir}
751b815c7f3Sopenharmony_ci    Program directory : ................... ${full_absolute_bindir}
752b815c7f3Sopenharmony_ci    Pkgconfig directory : ................. ${full_absolute_pkgconfigdir}
753b815c7f3Sopenharmony_ci    HTML docs directory : ................. ${full_absolute_htmldir}
754b815c7f3Sopenharmony_ci
755b815c7f3Sopenharmony_ciCompiling some other packages against libsndfile may require
756b815c7f3Sopenharmony_cithe addition of '$full_absolute_pkgconfigdir' to the
757b815c7f3Sopenharmony_ciPKG_CONFIG_PATH environment variable.
758b815c7f3Sopenharmony_ci])
759b815c7f3Sopenharmony_ci
760b815c7f3Sopenharmony_cidnl Remove symlink created by Scripts/android-configure.sh.
761b815c7f3Sopenharmony_cirm -f gdbclient
762