1159b3361Sopenharmony_cidnl $Id$
2159b3361Sopenharmony_cidnl
3159b3361Sopenharmony_cidnl
4159b3361Sopenharmony_cidnl don't forget to set ASM_FOR_ARCH to a space delimited list of
5159b3361Sopenharmony_cidnl processor architectures, for which assembler routines exist
6159b3361Sopenharmony_cidnl
7159b3361Sopenharmony_cidnl
8159b3361Sopenharmony_cidnl Exported and configured variables:
9159b3361Sopenharmony_cidnl CC
10159b3361Sopenharmony_cidnl CFLAGS
11159b3361Sopenharmony_cidnl LDFLAGS
12159b3361Sopenharmony_cidnl LDADD
13159b3361Sopenharmony_cidnl NASM
14159b3361Sopenharmony_ci
15159b3361Sopenharmony_cidnl extra vars for frontend:
16159b3361Sopenharmony_cidnl FRONTEND_LDFLAGS
17159b3361Sopenharmony_cidnl FRONTEND_CFLAGS
18159b3361Sopenharmony_cidnl FRONTEND_LDADD
19159b3361Sopenharmony_ci
20159b3361Sopenharmony_cidnl extra vars for libmp3lame:
21159b3361Sopenharmony_cidnl LIBMP3LAME_LDADD
22159b3361Sopenharmony_ci
23159b3361Sopenharmony_ciAC_PREREQ(2.69)
24159b3361Sopenharmony_ciAC_INIT([lame],[3.100],[lame-dev@lists.sf.net])
25159b3361Sopenharmony_ciAC_CONFIG_SRCDIR([libmp3lame/lame.c])
26159b3361Sopenharmony_ciAC_LANG([C])
27159b3361Sopenharmony_ci
28159b3361Sopenharmony_cidnl check system
29159b3361Sopenharmony_ciAC_CANONICAL_HOST
30159b3361Sopenharmony_ci
31159b3361Sopenharmony_cidnl automake
32159b3361Sopenharmony_ciAM_INIT_AUTOMAKE
33159b3361Sopenharmony_ciAC_CONFIG_HEADERS([config.h])
34159b3361Sopenharmony_ciAH_TOP([
35159b3361Sopenharmony_ci#ifndef LAME_CONFIG_H
36159b3361Sopenharmony_ci#define LAME_CONFIG_H
37159b3361Sopenharmony_ci])
38159b3361Sopenharmony_ciAH_BOTTOM([#endif /* LAME_CONFIG_H */])
39159b3361Sopenharmony_ciAM_MAINTAINER_MODE
40159b3361Sopenharmony_ciAM_MAKE_INCLUDE
41159b3361Sopenharmony_ciPKG_PROG_PKG_CONFIG([])
42159b3361Sopenharmony_ci
43159b3361Sopenharmony_cidnl check environment
44159b3361Sopenharmony_ciAC_AIX
45159b3361Sopenharmony_ciAC_ISC_POSIX
46159b3361Sopenharmony_ciAC_MINIX
47159b3361Sopenharmony_cicase $host_os in
48159b3361Sopenharmony_ci  *cygwin* ) CYGWIN=yes;;
49159b3361Sopenharmony_ci         * ) CYGWIN=no;;
50159b3361Sopenharmony_ciesac
51159b3361Sopenharmony_ci
52159b3361Sopenharmony_cidnl libtool
53159b3361Sopenharmony_ci# AC_DISABLE_SHARED
54159b3361Sopenharmony_ciAC_PROG_LIBTOOL
55159b3361Sopenharmony_ciAC_SUBST(LIBTOOL_DEPS)
56159b3361Sopenharmony_ciCFLAGS="${ac_save_CFLAGS}"
57159b3361Sopenharmony_ci
58159b3361Sopenharmony_ci# increase this when the shared lib becomes totally incompatible
59159b3361Sopenharmony_ciLIB_MAJOR_VERSION=0
60159b3361Sopenharmony_ci
61159b3361Sopenharmony_ci# increase this when changes are made, but they are upward compatible
62159b3361Sopenharmony_ci# to previous versions
63159b3361Sopenharmony_ciLIB_MINOR_VERSION=0
64159b3361Sopenharmony_ci
65159b3361Sopenharmony_cidnl # work around for a bug, don't know where it is exactly
66159b3361Sopenharmony_ciif test "${ac_cv_cygwin}" = "yes"; then
67159b3361Sopenharmony_ci	if test "${CC}" != "gcc"; then
68159b3361Sopenharmony_ci		AC_MSG_ERROR([Please use]
69159b3361Sopenharmony_ci			[   CC=gcc ./configure]
70159b3361Sopenharmony_ci			[Abort this configure run and add "CC=gcc" or you will]
71159b3361Sopenharmony_ci			[see errors and no lame.exe will be build.])
72159b3361Sopenharmony_ci	fi
73159b3361Sopenharmony_cifi
74159b3361Sopenharmony_ci
75159b3361Sopenharmony_cidnl check programs
76159b3361Sopenharmony_ciAC_PROG_CC()
77159b3361Sopenharmony_ci
78159b3361Sopenharmony_ciif test "x${GCC}" = "xyes"; then
79159b3361Sopenharmony_ci	AC_MSG_CHECKING(compiler)
80159b3361Sopenharmony_ci	COMPILER_TYPE="`${CC} --version | head -1 | sed -e '1,$s/version.*//g'`"
81159b3361Sopenharmony_ci	case "${COMPILER_TYPE}" in
82159b3361Sopenharmony_ci	*gcc*)
83159b3361Sopenharmony_ci		AC_MSG_RESULT(gcc)
84159b3361Sopenharmony_ci		HAVE_GCC=yes
85159b3361Sopenharmony_ci		HAVE_CLANG=no
86159b3361Sopenharmony_ci		;;
87159b3361Sopenharmony_ci	*clang*)
88159b3361Sopenharmony_ci		AC_MSG_RESULT(clang)
89159b3361Sopenharmony_ci		HAVE_CLANG=yes
90159b3361Sopenharmony_ci		HAVE_GCC=no
91159b3361Sopenharmony_ci		;;
92159b3361Sopenharmony_ci	*)
93159b3361Sopenharmony_ci		AC_MSG_RESULT(unknown)
94159b3361Sopenharmony_ci		HAVE_GCC=no
95159b3361Sopenharmony_ci		HAVE_CLANG=no
96159b3361Sopenharmony_ci		;;
97159b3361Sopenharmony_ci	esac
98159b3361Sopenharmony_ci
99159b3361Sopenharmony_ci	if test "${HAVE_GCC}" = "yes"; then
100159b3361Sopenharmony_ci		AC_MSG_CHECKING(version of GCC)
101159b3361Sopenharmony_ci		GCC_version="`${CC} --version | sed -n '1s/^[[^ ]]* (.*) //;s/ .*$//;1p'`"
102159b3361Sopenharmony_ci		case "${GCC_version}" in 
103159b3361Sopenharmony_ci		[[0-9]]*[[0-9]]*)
104159b3361Sopenharmony_ci			AC_MSG_RESULT(${GCC_version})
105159b3361Sopenharmony_ci			;;
106159b3361Sopenharmony_ci		*)
107159b3361Sopenharmony_ci			# probably not gcc...
108159b3361Sopenharmony_ci			AC_MSG_RESULT(unknown compiler version pattern, playing safe and disabling gcc optimisations... ${GCC_version})
109159b3361Sopenharmony_ci			HAVE_GCC=no
110159b3361Sopenharmony_ci			;;
111159b3361Sopenharmony_ci		esac
112159b3361Sopenharmony_ci	fi
113159b3361Sopenharmony_ci
114159b3361Sopenharmony_ci	if test "${HAVE_CLANG}" = "yes"; then
115159b3361Sopenharmony_ci		AC_MSG_CHECKING(version of clang)
116159b3361Sopenharmony_ci		CLANG_version="`${CC} --version | sed -n 's/.*clang version //;s/ .*$//;1p'`"
117159b3361Sopenharmony_ci		AC_MSG_RESULT(${CLANG_version})
118159b3361Sopenharmony_ci	fi
119159b3361Sopenharmony_cifi
120159b3361Sopenharmony_ci
121159b3361Sopenharmony_ci
122159b3361Sopenharmony_ci
123159b3361Sopenharmony_ciAC_CHECK_HEADER(dmalloc.h)
124159b3361Sopenharmony_ciif test "${ac_cv_header_dmalloc_h}" = "yes"; then
125159b3361Sopenharmony_ci	AM_WITH_DMALLOC
126159b3361Sopenharmony_cifi
127159b3361Sopenharmony_ci
128159b3361Sopenharmony_cidnl Checks for header files.
129159b3361Sopenharmony_ciAC_HEADER_STDC
130159b3361Sopenharmony_ciAC_CHECK_HEADERS( \
131159b3361Sopenharmony_ci		 errno.h \
132159b3361Sopenharmony_ci		 fcntl.h \
133159b3361Sopenharmony_ci		 limits.h \
134159b3361Sopenharmony_ci		 stdint.h \
135159b3361Sopenharmony_ci		 string.h \
136159b3361Sopenharmony_ci		 sys/soundcard.h \
137159b3361Sopenharmony_ci		 sys/time.h \
138159b3361Sopenharmony_ci		 unistd.h \
139159b3361Sopenharmony_ci		 linux/soundcard.h)
140159b3361Sopenharmony_ci
141159b3361Sopenharmony_cidnl Checks for actually working SSE intrinsics
142159b3361Sopenharmony_ciAC_MSG_CHECKING(working SSE intrinsics)
143159b3361Sopenharmony_ciAC_COMPILE_IFELSE(
144159b3361Sopenharmony_ci	[AC_LANG_PROGRAM(
145159b3361Sopenharmony_ci		[[#include <xmmintrin.h>]],
146159b3361Sopenharmony_ci		[[_mm_sfence();]])],
147159b3361Sopenharmony_ci	[AC_DEFINE([HAVE_XMMINTRIN_H], [1], [Define if SSE intrinsics work.])
148159b3361Sopenharmony_ci	 ac_cv_header_xmmintrin_h=yes],
149159b3361Sopenharmony_ci	[ac_cv_header_xmmintrin_h=no])
150159b3361Sopenharmony_ciAC_MSG_RESULT(${ac_cv_header_xmmintrin_h})
151159b3361Sopenharmony_ci
152159b3361Sopenharmony_cidnl Checks for typedefs, structures, and compiler characteristics.
153159b3361Sopenharmony_ciAC_C_CONST
154159b3361Sopenharmony_ciAC_C_INLINE
155159b3361Sopenharmony_ciif test ${cross_compiling} = "no"; then
156159b3361Sopenharmony_ci	AC_C_BIGENDIAN
157159b3361Sopenharmony_cifi
158159b3361Sopenharmony_ci
159159b3361Sopenharmony_ciAC_SYS_LARGEFILE
160159b3361Sopenharmony_ci
161159b3361Sopenharmony_ciAC_CHECK_SIZEOF(short)
162159b3361Sopenharmony_ciAC_CHECK_SIZEOF(unsigned short)
163159b3361Sopenharmony_ciAC_CHECK_SIZEOF(int)
164159b3361Sopenharmony_ciAC_CHECK_SIZEOF(unsigned int)
165159b3361Sopenharmony_ciAC_CHECK_SIZEOF(long)
166159b3361Sopenharmony_ciAC_CHECK_SIZEOF(unsigned long)
167159b3361Sopenharmony_ciAC_CHECK_SIZEOF(long long)
168159b3361Sopenharmony_ciAC_CHECK_SIZEOF(unsigned long long)
169159b3361Sopenharmony_ciAC_CHECK_SIZEOF(float)
170159b3361Sopenharmony_ciAC_CHECK_SIZEOF(double)
171159b3361Sopenharmony_ci
172159b3361Sopenharmony_ciif test $ac_cv_sizeof_short -eq 0 \
173159b3361Sopenharmony_ci    -o $ac_cv_sizeof_unsigned_short -eq 0 \
174159b3361Sopenharmony_ci    -o $ac_cv_sizeof_int -eq 0 \
175159b3361Sopenharmony_ci    -o $ac_cv_sizeof_unsigned_int -eq 0 \
176159b3361Sopenharmony_ci    -o $ac_cv_sizeof_long -eq 0 \
177159b3361Sopenharmony_ci    -o $ac_cv_sizeof_unsigned_long -eq 0 \
178159b3361Sopenharmony_ci    -o $ac_cv_sizeof_long_long -eq 0 \
179159b3361Sopenharmony_ci    -o $ac_cv_sizeof_unsigned_long_long -eq 0 \
180159b3361Sopenharmony_ci    -o $ac_cv_sizeof_float -eq 0 \
181159b3361Sopenharmony_ci    -o $ac_cv_sizeof_double -eq 0; then
182159b3361Sopenharmony_ci	echo '*** I have a problem determining the size of some variable types. Either'
183159b3361Sopenharmony_ci	echo '*** you compiler is broken, or your system+compiler combination is not'
184159b3361Sopenharmony_ci	echo '*** supportet by the "autoconf" framework we use to generate this'
185159b3361Sopenharmony_ci	echo '*** configure script.'
186159b3361Sopenharmony_ci	exit 1
187159b3361Sopenharmony_cifi
188159b3361Sopenharmony_ci
189159b3361Sopenharmony_ciAC_C_LONG_DOUBLE
190159b3361Sopenharmony_ciif test "${ac_cv_c_have_long_double}" = "yes" ; then
191159b3361Sopenharmony_ci	AC_CHECK_SIZEOF(long double)
192159b3361Sopenharmony_cifi
193159b3361Sopenharmony_ci
194159b3361Sopenharmony_ciAC_CHECK_TYPES([uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t])
195159b3361Sopenharmony_ci
196159b3361Sopenharmony_ciAH_VERBATIM([HAVE_UINT8_T],
197159b3361Sopenharmony_ci[/* add uint8_t type */
198159b3361Sopenharmony_ci#undef HAVE_UINT8_T
199159b3361Sopenharmony_ci#ifndef HAVE_UINT8_T
200159b3361Sopenharmony_ci	typedef unsigned char uint8_t;
201159b3361Sopenharmony_ci#endif])
202159b3361Sopenharmony_ci
203159b3361Sopenharmony_ciAH_VERBATIM([HAVE_INT8_T],
204159b3361Sopenharmony_ci[/* add int8_t type */
205159b3361Sopenharmony_ci#undef HAVE_INT8_T
206159b3361Sopenharmony_ci#ifndef HAVE_INT8_T
207159b3361Sopenharmony_ci	typedef char int8_t;
208159b3361Sopenharmony_ci#endif])
209159b3361Sopenharmony_ci
210159b3361Sopenharmony_ciAH_VERBATIM([HAVE_UINT16_T],
211159b3361Sopenharmony_ci[/* add uint16_t type */
212159b3361Sopenharmony_ci#undef HAVE_UINT16_T
213159b3361Sopenharmony_ci#ifndef HAVE_UINT16_T
214159b3361Sopenharmony_ci	typedef unsigned short uint16_t;
215159b3361Sopenharmony_ci#endif])
216159b3361Sopenharmony_ci
217159b3361Sopenharmony_ciAH_VERBATIM([HAVE_INT16_T],
218159b3361Sopenharmony_ci[/* add int16_t type */
219159b3361Sopenharmony_ci#undef HAVE_INT16_T
220159b3361Sopenharmony_ci#ifndef HAVE_INT16_T
221159b3361Sopenharmony_ci	typedef short int16_t;
222159b3361Sopenharmony_ci#endif])
223159b3361Sopenharmony_ci
224159b3361Sopenharmony_ciif test "${HAVE_INT32_T}" = yes; then
225159b3361Sopenharmony_ci	AC_DEFINE(A_UINT32_T,unsigned int32_t)
226159b3361Sopenharmony_cielse
227159b3361Sopenharmony_ci	if test "${ac_cv_sizeof_unsigned_short}" = "4"; then
228159b3361Sopenharmony_ci		AC_DEFINE(A_UINT32_T,unsigned short)
229159b3361Sopenharmony_ci	else
230159b3361Sopenharmony_ci		if test "${ac_cv_sizeof_unsigned_int}" = "4"; then
231159b3361Sopenharmony_ci			AC_DEFINE(A_UINT32_T,unsigned int)
232159b3361Sopenharmony_ci		else
233159b3361Sopenharmony_ci			if test "${ac_cv_sizeof_unsigned_long}" = "4"; then
234159b3361Sopenharmony_ci				AC_DEFINE(A_UINT32_T,unsigned long)
235159b3361Sopenharmony_ci			else
236159b3361Sopenharmony_ci				AC_MSG_ERROR([CHECK_TYPE_uint32_t - please report to lame-dev@lists.sourceforge.net])
237159b3361Sopenharmony_ci			fi
238159b3361Sopenharmony_ci		fi
239159b3361Sopenharmony_ci	fi
240159b3361Sopenharmony_cifi
241159b3361Sopenharmony_ci
242159b3361Sopenharmony_ciAH_VERBATIM([HAVE_UINT32_T],
243159b3361Sopenharmony_ci[/* add uint32_t type */
244159b3361Sopenharmony_ci#undef HAVE_UINT32_T
245159b3361Sopenharmony_ci#ifndef HAVE_UINT32_T
246159b3361Sopenharmony_ci#undef A_UINT32_T
247159b3361Sopenharmony_ci	typedef A_UINT32_T uint32_t;
248159b3361Sopenharmony_ci#endif])
249159b3361Sopenharmony_ci
250159b3361Sopenharmony_ciif test "${ac_cv_sizeof_short}" = "4"; then
251159b3361Sopenharmony_ci	AC_DEFINE(A_INT32_T,short)
252159b3361Sopenharmony_cielse
253159b3361Sopenharmony_ci	if test "${ac_cv_sizeof_int}" = "4"; then
254159b3361Sopenharmony_ci		AC_DEFINE(A_INT32_T,int)
255159b3361Sopenharmony_ci	else
256159b3361Sopenharmony_ci		if test "${ac_cv_sizeof_long}" = "4"; then
257159b3361Sopenharmony_ci			AC_DEFINE(A_INT32_T,long)
258159b3361Sopenharmony_ci		else
259159b3361Sopenharmony_ci			AC_MSG_ERROR([CHECK_TYPE_int32_t - please report to lame-dev@lists.sourceforge.net])
260159b3361Sopenharmony_ci		fi
261159b3361Sopenharmony_ci	fi
262159b3361Sopenharmony_cifi
263159b3361Sopenharmony_ci
264159b3361Sopenharmony_ciAH_VERBATIM([HAVE_INT32_T],
265159b3361Sopenharmony_ci[/* add int32_t type */
266159b3361Sopenharmony_ci#undef HAVE_INT32_T
267159b3361Sopenharmony_ci#ifndef HAVE_INT32_T
268159b3361Sopenharmony_ci#undef A_INT32_T
269159b3361Sopenharmony_ci	typedef A_INT32_T int32_t;
270159b3361Sopenharmony_ci#endif])
271159b3361Sopenharmony_ci
272159b3361Sopenharmony_ciif test "${HAVE_INT64_T}" = yes; then
273159b3361Sopenharmony_ci        AC_DEFINE(A_UINT64_T,unsigned int64_t)
274159b3361Sopenharmony_cielse
275159b3361Sopenharmony_ci	if test "${ac_cv_sizeof_unsigned_int}" = "8"; then
276159b3361Sopenharmony_ci		AC_DEFINE(A_UINT64_T,unsigned int)
277159b3361Sopenharmony_ci	else
278159b3361Sopenharmony_ci		if test "${ac_cv_sizeof_unsigned_long}" = "8"; then
279159b3361Sopenharmony_ci			AC_DEFINE(A_UINT64_T,unsigned long)
280159b3361Sopenharmony_ci		else
281159b3361Sopenharmony_ci			if test "${ac_cv_sizeof_unsigned_long_long}" = "8"; then
282159b3361Sopenharmony_ci				AC_DEFINE(A_UINT64_T,unsigned long long)
283159b3361Sopenharmony_ci			else
284159b3361Sopenharmony_ci				AC_MSG_ERROR([CHECK_TYPE_uint64_t - please report to lame-dev@lists.sourceforge.net])
285159b3361Sopenharmony_ci			fi
286159b3361Sopenharmony_ci		fi
287159b3361Sopenharmony_ci	fi
288159b3361Sopenharmony_cifi
289159b3361Sopenharmony_ci
290159b3361Sopenharmony_ciAH_VERBATIM([HAVE_UINT64_T],
291159b3361Sopenharmony_ci[/* add uint64_t type */
292159b3361Sopenharmony_ci#undef HAVE_UINT64_T
293159b3361Sopenharmony_ci#ifndef HAVE_UINT64_T
294159b3361Sopenharmony_ci#undef A_UINT64_T
295159b3361Sopenharmony_ci	typedef A_UINT64_T uint64_t;
296159b3361Sopenharmony_ci#endif])
297159b3361Sopenharmony_ci
298159b3361Sopenharmony_ciif test "${ac_cv_sizeof_int}" = "8"; then
299159b3361Sopenharmony_ci	AC_DEFINE(A_INT64_T,int)
300159b3361Sopenharmony_cielse
301159b3361Sopenharmony_ci	if test "${ac_cv_sizeof_long}" = "8"; then
302159b3361Sopenharmony_ci		AC_DEFINE(A_INT64_T,long)
303159b3361Sopenharmony_ci	else
304159b3361Sopenharmony_ci		if test "${ac_cv_sizeof_long_long}" = "8"; then
305159b3361Sopenharmony_ci			AC_DEFINE(A_INT64_T,long long)
306159b3361Sopenharmony_ci		else
307159b3361Sopenharmony_ci			AC_MSG_ERROR([CHECK_TYPE_int64_t - please report to lame-dev@lists.sourceforge.net])
308159b3361Sopenharmony_ci		fi
309159b3361Sopenharmony_ci	fi
310159b3361Sopenharmony_cifi
311159b3361Sopenharmony_ci
312159b3361Sopenharmony_ciAH_VERBATIM([HAVE_INT64_T],
313159b3361Sopenharmony_ci[/* add int64_t type */
314159b3361Sopenharmony_ci#undef HAVE_INT64_T
315159b3361Sopenharmony_ci#ifndef HAVE_INT64_T
316159b3361Sopenharmony_ci#undef A_INT64_T
317159b3361Sopenharmony_ci	typedef A_INT64_T int64_t;
318159b3361Sopenharmony_ci#endif])
319159b3361Sopenharmony_ci
320159b3361Sopenharmony_cialex_IEEE854_FLOAT80
321159b3361Sopenharmony_ciif test "${alex_cv_ieee854_float80}" = "yes" ; then
322159b3361Sopenharmony_ci	if test "${ac_cv_c_long_double}" = "yes" ; then
323159b3361Sopenharmony_ci		AC_CHECK_TYPES(ieee854_float80_t, long double)
324159b3361Sopenharmony_ci		AH_VERBATIM([HAVE_IEEE854_FLOAT80_T],
325159b3361Sopenharmony_ci[/* add ieee854_float80_t type */
326159b3361Sopenharmony_ci#undef HAVE_IEEE854_FLOAT80_T
327159b3361Sopenharmony_ci#ifndef HAVE_IEEE854_FLOAT80_T
328159b3361Sopenharmony_ci	typedef long double ieee854_float80_t;
329159b3361Sopenharmony_ci#endif])
330159b3361Sopenharmony_ci
331159b3361Sopenharmony_ci		AC_DEFINE(HAVE_IEEE854_FLOAT80, 1, [system has 80 bit floats])
332159b3361Sopenharmony_ci	fi
333159b3361Sopenharmony_cifi
334159b3361Sopenharmony_ciAC_CHECK_TYPES([ieee754_float64_t, ieee754_float32_t])
335159b3361Sopenharmony_ci
336159b3361Sopenharmony_ciAH_VERBATIM([HAVE_IEEE754_FLOAT64_T],
337159b3361Sopenharmony_ci[/* add ieee754_float64_t type */
338159b3361Sopenharmony_ci#undef HAVE_IEEE754_FLOAT64_T
339159b3361Sopenharmony_ci#ifndef HAVE_IEEE754_FLOAT64_T
340159b3361Sopenharmony_ci	typedef double ieee754_float64_t;
341159b3361Sopenharmony_ci#endif])
342159b3361Sopenharmony_ci
343159b3361Sopenharmony_ciAH_VERBATIM([HAVE_IEEE754_FLOAT32_T],
344159b3361Sopenharmony_ci[/* add ieee754_float32_t type */
345159b3361Sopenharmony_ci#undef HAVE_IEEE754_FLOAT32_T
346159b3361Sopenharmony_ci#ifndef HAVE_IEEE754_FLOAT32_T
347159b3361Sopenharmony_ci	typedef float ieee754_float32_t;
348159b3361Sopenharmony_ci#endif])
349159b3361Sopenharmony_ci
350159b3361Sopenharmony_ciAC_DEFINE(LAME_LIBRARY_BUILD, 1, [requested by Frank, seems to be temporary needed for a smooth transition])
351159b3361Sopenharmony_ci
352159b3361Sopenharmony_ci
353159b3361Sopenharmony_ciif test ${cross_compiling} = "yes"; then
354159b3361Sopenharmony_ci	AC_MSG_WARN([]
355159b3361Sopenharmony_ci  [**************************************************************************]
356159b3361Sopenharmony_ci  [*                                                                        *]
357159b3361Sopenharmony_ci  [* You are cross compiling:                                               *]
358159b3361Sopenharmony_ci  [*   - I did not have a change to determine                               *]
359159b3361Sopenharmony_ci  [*     + the size of:                                                     *]
360159b3361Sopenharmony_ci  [*       - short                                                          *]
361159b3361Sopenharmony_ci  [*       - unsigned short                                                 *]
362159b3361Sopenharmony_ci  [*       - int                                                            *]
363159b3361Sopenharmony_ci  [*       - unsigned int                                                   *]
364159b3361Sopenharmony_ci  [*       - long                                                           *]
365159b3361Sopenharmony_ci  [*       - unsigned long                                                  *]
366159b3361Sopenharmony_ci  [*       - float                                                          *]
367159b3361Sopenharmony_ci  [*       - double                                                         *]
368159b3361Sopenharmony_ci  [*       - long double                                                    *]
369159b3361Sopenharmony_ci  [*     + the endianess of the system                                      *]
370159b3361Sopenharmony_ci  [*   - You have to provide appropriate defines for them in config.h, e.g. *]
371159b3361Sopenharmony_ci  [*     + define SIZEOF_SHORT to 2 if the size of a short is 2             *]
372159b3361Sopenharmony_ci  [*     + define WORDS_BIGENDIAN if your system is a big endian system     *]
373159b3361Sopenharmony_ci  [*                                                                        *]
374159b3361Sopenharmony_ci  [**************************************************************************])
375159b3361Sopenharmony_cifi
376159b3361Sopenharmony_ci
377159b3361Sopenharmony_ciAC_TYPE_SIZE_T
378159b3361Sopenharmony_ciAC_HEADER_TIME
379159b3361Sopenharmony_ci
380159b3361Sopenharmony_cidnl Checks for library functions.
381159b3361Sopenharmony_ciAC_FUNC_ALLOCA
382159b3361Sopenharmony_ciAC_CHECK_FUNCS(gettimeofday strtol)
383159b3361Sopenharmony_ci
384159b3361Sopenharmony_ciif test "X${ac_cv_func_strtol}" != "Xyes"; then
385159b3361Sopenharmony_ci	AC_MSG_ERROR([function strtol is mandatory])
386159b3361Sopenharmony_cifi
387159b3361Sopenharmony_ci
388159b3361Sopenharmony_cidnl Check if we are on a mingw system, which needs libwsock32
389159b3361Sopenharmony_ciSOCKETFUNCTION=unknown
390159b3361Sopenharmony_ciAC_CHECK_FUNCS(socket)
391159b3361Sopenharmony_ciif test $ac_cv_func_socket = no; then
392159b3361Sopenharmony_ci	# maybe it is in libsocket
393159b3361Sopenharmony_ci	AC_CHECK_LIB(socket, socket, [AC_DEFINE(HAVE_SOCKET)
394159b3361Sopenharmony_ci	LIBS="$LIBS -lsocket"])
395159b3361Sopenharmony_ci	if test "X${ac_cv_lib_socket_socket}" != "Xyes"; then
396159b3361Sopenharmony_ci		SOCKETFUNCTION=NO
397159b3361Sopenharmony_ci	else
398159b3361Sopenharmony_ci		case ${host_os} in
399159b3361Sopenharmony_ci		*solaris*)
400159b3361Sopenharmony_ci			LIBS="$LIBS -lnsl"
401159b3361Sopenharmony_ci			;;
402159b3361Sopenharmony_ci		esac
403159b3361Sopenharmony_ci	fi
404159b3361Sopenharmony_cifi
405159b3361Sopenharmony_ci
406159b3361Sopenharmony_cidnl Initialize configuration variables for the Makefile
407159b3361Sopenharmony_ciCFLAGS=${CFLAGS}
408159b3361Sopenharmony_ciCONFIG_DEFS=${CONFIG_DEFS}
409159b3361Sopenharmony_ciNASM=
410159b3361Sopenharmony_ciINCLUDES="-I\$(top_srcdir)/include -I\$(srcdir)"
411159b3361Sopenharmony_ciFRONTEND_LDFLAGS=
412159b3361Sopenharmony_ciFRONTEND_CFLAGS=
413159b3361Sopenharmony_ciLIB_SOURCES=
414159b3361Sopenharmony_ciMAKEDEP="-M"
415159b3361Sopenharmony_ciRM_F="rm -f"
416159b3361Sopenharmony_ci
417159b3361Sopenharmony_ciAC_ARG_ENABLE(nasm,
418159b3361Sopenharmony_ci  [  --enable-nasm           Allow the use of nasm if available],
419159b3361Sopenharmony_ci  ASM_FOR_ARCH="i386", ASM_FOR_ARCH="")
420159b3361Sopenharmony_ci
421159b3361Sopenharmony_ciAC_ARG_ENABLE(ieeehack,
422159b3361Sopenharmony_ci  [  --enable-ieeehack       Enable Takhiros IEEE754 hack (speed improvement for old CPUs)],
423159b3361Sopenharmony_ci  IEEE754_HACK="yes", IEEE754_HACK="no")
424159b3361Sopenharmony_cicase ${IEEE754_HACK} in
425159b3361Sopenharmony_ci	yes)
426159b3361Sopenharmony_ci		AC_DEFINE(TAKEHIRO_IEEE754_HACK, 1, IEEE754 compatible machine)
427159b3361Sopenharmony_ci		;;
428159b3361Sopenharmony_ci	no)
429159b3361Sopenharmony_ci		AC_DEFINE(TAKEHIRO_IEEE754_HACK, 0, IEEE754 compatible machine)
430159b3361Sopenharmony_ci		;;
431159b3361Sopenharmony_ciesac
432159b3361Sopenharmony_ci
433159b3361Sopenharmony_cidnl Checks for libraries.
434159b3361Sopenharmony_ci
435159b3361Sopenharmony_ciAC_CHECK_HEADERS(termcap.h)
436159b3361Sopenharmony_ciAC_CHECK_HEADERS(ncurses/termcap.h)
437159b3361Sopenharmony_ciAC_CHECK_LIB(termcap, initscr, HAVE_TERMCAP="termcap")
438159b3361Sopenharmony_ciAC_CHECK_LIB(curses, initscr, HAVE_TERMCAP="curses")
439159b3361Sopenharmony_ciAC_CHECK_LIB(ncurses, initscr, HAVE_TERMCAP="ncurses")
440159b3361Sopenharmony_ciAC_CHECK_HEADERS(langinfo.h, AC_CHECK_FUNCS(nl_langinfo))
441159b3361Sopenharmony_ci
442159b3361Sopenharmony_ciAM_ICONV
443159b3361Sopenharmony_ci
444159b3361Sopenharmony_cidnl math lib
445159b3361Sopenharmony_ciAC_CHECK_LIB(m, cos, USE_LIBM="-lm")
446159b3361Sopenharmony_cidnl free fast math library
447159b3361Sopenharmony_ciAC_CHECK_LIB(ffm, cos, USE_LIBM="-lffm -lm")
448159b3361Sopenharmony_cidnl Compaq fast math library.
449159b3361Sopenharmony_ciAC_ARG_ENABLE(cpml,
450159b3361Sopenharmony_ci  [  --disable-cpml          Do not use Compaq's fast Math Library],
451159b3361Sopenharmony_ci  CONFIG_CPML="no", CONFIG_CPML="yes")
452159b3361Sopenharmony_ciif test "${CONFIG_CPML}" = yes; then
453159b3361Sopenharmony_ci      AC_CHECK_LIB(cpml, cos, USE_LIBM="-lcpml")
454159b3361Sopenharmony_cifi
455159b3361Sopenharmony_ciCONFIG_MATH_LIB="${USE_LIBM}"
456159b3361Sopenharmony_ci
457159b3361Sopenharmony_cidnl configure use of features
458159b3361Sopenharmony_ci
459159b3361Sopenharmony_ciAM_PATH_GTK(1.2.0, HAVE_GTK="yes", HAVE_GTK="no")
460159b3361Sopenharmony_ci
461159b3361Sopenharmony_cidnl ElectricFence malloc debugging
462159b3361Sopenharmony_ciAC_MSG_CHECKING(use of ElectricFence malloc debugging)
463159b3361Sopenharmony_ciAC_ARG_ENABLE(efence,
464159b3361Sopenharmony_ci  [  --enable-efence         Use ElectricFence for malloc debugging],
465159b3361Sopenharmony_ci  CONFIG_EFENCE="${enableval}", CONFIG_EFENCE="no")
466159b3361Sopenharmony_ci
467159b3361Sopenharmony_cicase "${CONFIG_EFENCE}" in
468159b3361Sopenharmony_ciyes)
469159b3361Sopenharmony_ci	AC_CHECK_LIB(efence, EF_Print, HAVE_EFENCE="-lefence")
470159b3361Sopenharmony_ci	if test "x${HAVE_EFENCE}" != "x-lefence"; then
471159b3361Sopenharmony_ci		AC_MSG_RESULT(yes, but libefence not found)
472159b3361Sopenharmony_ci	else
473159b3361Sopenharmony_ci		LDADD="${LDADD} ${HAVE_EFENCE}"
474159b3361Sopenharmony_ci		AC_DEFINE(HAVE_EFENCE, 1, we link against libefence)
475159b3361Sopenharmony_ci		AC_MSG_RESULT(${CONFIG_EFENCE})
476159b3361Sopenharmony_ci	fi
477159b3361Sopenharmony_ci	;;
478159b3361Sopenharmony_cino)
479159b3361Sopenharmony_ci	AC_MSG_RESULT(${CONFIG_EFENCE})
480159b3361Sopenharmony_ci	;;
481159b3361Sopenharmony_ci*)
482159b3361Sopenharmony_ci	AC_MSG_ERROR(bad value �${CONFIG_EFENCE}� for efence option)
483159b3361Sopenharmony_ci	;;
484159b3361Sopenharmony_ciesac
485159b3361Sopenharmony_ci
486159b3361Sopenharmony_ci
487159b3361Sopenharmony_cidnl libsndfile
488159b3361Sopenharmony_ciWARNING=
489159b3361Sopenharmony_ciAC_ARG_WITH(fileio,
490159b3361Sopenharmony_ci  [  --with-fileio=lame      Use lame's internal file io routines [default]]
491159b3361Sopenharmony_ci  [             =sndfile   Use Erik de Castro Lopo's libsndfile]
492159b3361Sopenharmony_ci  [                        (no stdin possible currently)],
493159b3361Sopenharmony_ci  CONFIG_FILEIO="${withval}", CONFIG_FILEIO="lame")
494159b3361Sopenharmony_ci
495159b3361Sopenharmony_ciif test "${CONFIG_FILEIO}" = "sndfile" ; then
496159b3361Sopenharmony_ci  PKG_CHECK_MODULES(SNDFILE, sndfile >= 1.0.2, HAVE_SNDFILE="yes", HAVE_SNDFILE="no")
497159b3361Sopenharmony_cifi
498159b3361Sopenharmony_ci
499159b3361Sopenharmony_ciAC_MSG_CHECKING(use of file io)
500159b3361Sopenharmony_ci
501159b3361Sopenharmony_ciif test "${CONFIG_FILEIO}" = "sndfile" ; then
502159b3361Sopenharmony_ci  if test "${HAVE_SNDFILE}" = "yes" -o "x${SNDFILE_LIBS}" != "x" \
503159b3361Sopenharmony_ci    -o "x${SNDFILE_CFLAGS}" != "x"; then
504159b3361Sopenharmony_ci    SNDFILE_LIBS=`echo ${SNDFILE_LIBS}`
505159b3361Sopenharmony_ci    SNDFILE_CFLAGS=`echo ${SNDFILE_CFLAGS}`
506159b3361Sopenharmony_ci
507159b3361Sopenharmony_ci    if test -n "${SNDFILE_LIBS}" ; then
508159b3361Sopenharmony_ci      FRONTEND_LDFLAGS="${SNDFILE_LIBS} ${FRONTEND_LDFLAGS}"
509159b3361Sopenharmony_ci    fi
510159b3361Sopenharmony_ci    FRONTEND_LDADD="-lsndfile ${FRONTEND_LDADD}"
511159b3361Sopenharmony_ci
512159b3361Sopenharmony_ci    if test -n "${SNDFILE_CFLAGS}" ; then
513159b3361Sopenharmony_ci      INCLUDES="${SNDFILE_CFLAGS} ${INCLUDES}"
514159b3361Sopenharmony_ci    fi
515159b3361Sopenharmony_ci
516159b3361Sopenharmony_ci    AC_DEFINE(LIBSNDFILE, 1, set to 1 if you have libsndfile)
517159b3361Sopenharmony_ci  else
518159b3361Sopenharmony_ci    # default
519159b3361Sopenharmony_ci    CONFIG_FILEIO="lame"
520159b3361Sopenharmony_ci    WARNING="${WARNING} Could not find any sndfile lib on system."
521159b3361Sopenharmony_ci  fi
522159b3361Sopenharmony_cielse
523159b3361Sopenharmony_ci  CONFIG_FILEIO="lame"
524159b3361Sopenharmony_cifi
525159b3361Sopenharmony_ciAC_MSG_RESULT(${CONFIG_FILEIO})
526159b3361Sopenharmony_ciif test "x${WARNING}" != "x" ; then
527159b3361Sopenharmony_ci  AC_MSG_WARN($WARNING)
528159b3361Sopenharmony_cifi
529159b3361Sopenharmony_ci
530159b3361Sopenharmony_ci
531159b3361Sopenharmony_cidnl check if we should remove hooks for analyzer code in library
532159b3361Sopenharmony_cidnl default library must include these hooks
533159b3361Sopenharmony_ciAC_MSG_CHECKING(use of analyzer hooks)
534159b3361Sopenharmony_ciAC_ARG_ENABLE(analyzer-hooks,
535159b3361Sopenharmony_ci  [  --disable-analyzer-hooks Exclude analyzer hooks],
536159b3361Sopenharmony_ci  CONFIG_ANALYZER="${enableval}", CONFIG_ANALYZER="yes")
537159b3361Sopenharmony_ci
538159b3361Sopenharmony_cicase "${CONFIG_ANALYZER}" in
539159b3361Sopenharmony_ciyes)
540159b3361Sopenharmony_ci	;;
541159b3361Sopenharmony_cino)
542159b3361Sopenharmony_ci	AC_DEFINE(NOANALYSIS, 1, build without hooks for analyzer)
543159b3361Sopenharmony_ci	;;
544159b3361Sopenharmony_ci*)
545159b3361Sopenharmony_ci	AC_MSG_ERROR(bad value �${CONFIG_ANALYZER}� for analyzer-hooks option)
546159b3361Sopenharmony_ci	;;
547159b3361Sopenharmony_ciesac
548159b3361Sopenharmony_ciAC_MSG_RESULT($CONFIG_ANALYZER)
549159b3361Sopenharmony_ci
550159b3361Sopenharmony_ci
551159b3361Sopenharmony_cidnl mpg123 decoder
552159b3361Sopenharmony_ciPKG_CHECK_MODULES([mpg123], [libmpg123 >= 1.26.0], [HAVE_MPG123="yes"], [HAVE_MPG123="no"])
553159b3361Sopenharmony_ci
554159b3361Sopenharmony_ciAC_MSG_CHECKING(use of mpg123 decoder)
555159b3361Sopenharmony_ciAC_ARG_ENABLE(decoder,
556159b3361Sopenharmony_ci  [  --disable-decoder          Exclude mpg123 decoder (internal or external)],
557159b3361Sopenharmony_ci  CONFIG_DECODER="${enableval}", CONFIG_DECODER="yes")
558159b3361Sopenharmony_ciAC_ARG_ENABLE(libmpg123,
559159b3361Sopenharmony_ci  [  --disable-libmpg123        Disable use of external libmpg123 decoder (normally favoured over internal decoder)],
560159b3361Sopenharmony_ci  CONFIG_MPG123="${enableval}", CONFIG_MPG123="auto")
561159b3361Sopenharmony_ci
562159b3361Sopenharmony_ciif test "${CONFIG_MPG123}" = "yes" && ! test "${HAVE_MPG123}" = "yes"; then
563159b3361Sopenharmony_ci	AC_MSG_ERROR([libmpg123 decoder enforced but not found])
564159b3361Sopenharmony_cifi
565159b3361Sopenharmony_ciif test "${CONFIG_MPG123}" = "auto" && test "${HAVE_MPG123}" = "yes"; then
566159b3361Sopenharmony_ci	CONFIG_MPG123="yes"
567159b3361Sopenharmony_cifi
568159b3361Sopenharmony_ci
569159b3361Sopenharmony_ciLIB_WITH_DECODER=false
570159b3361Sopenharmony_ciif test "${CONFIG_MPG123}" = "yes" && test "${CONFIG_DECODER}" != "no"; then
571159b3361Sopenharmony_ci	CONFIG_DECODER="no"
572159b3361Sopenharmony_ci	AC_MSG_RESULT(enabled use of external libmpg123 decoder)
573159b3361Sopenharmony_ci	AC_DEFINE(HAVE_MPG123, 1, set to 1 if you have libmpg123)
574159b3361Sopenharmony_ci	AC_DEFINE(DECODE_ON_THE_FLY, 1, allow to compute a more accurate replaygain value)
575159b3361Sopenharmony_ci	FRONTEND_LDADD="$mpg123_LIBS $FRONTEND_LDADD"
576159b3361Sopenharmony_ci	LIBMP3LAME_LDADD="$mpg123_LIBS $LIBMP3LAME_LDADD"
577159b3361Sopenharmony_ci	INCLUDES="$mpg123_CFLAGS $INCLUDES"
578159b3361Sopenharmony_cielse
579159b3361Sopenharmony_ci	if test "${CONFIG_DECODER}" != "no" ; then
580159b3361Sopenharmony_ci		LIB_WITH_DECODER=true
581159b3361Sopenharmony_ci		CONFIG_DECODER="internal mpglib decoder (Layer 1, 2, 3)"
582159b3361Sopenharmony_ci		AC_MSG_RESULT($CONFIG_DECODER)
583159b3361Sopenharmony_ci		AC_DEFINE(HAVE_MPGLIB, 1, build with mpglib support)
584159b3361Sopenharmony_ci		AC_DEFINE(DECODE_ON_THE_FLY, 1, allow to compute a more accurate replaygain value)
585159b3361Sopenharmony_ci	else
586159b3361Sopenharmony_ci		AC_MSG_RESULT($CONFIG_DECODER)
587159b3361Sopenharmony_ci	fi
588159b3361Sopenharmony_cifi
589159b3361Sopenharmony_ciAM_CONDITIONAL(LIB_WITH_DECODER, ${LIB_WITH_DECODER})
590159b3361Sopenharmony_ci
591159b3361Sopenharmony_ciAC_MSG_CHECKING(if the lame frontend should be build)
592159b3361Sopenharmony_ciAC_ARG_ENABLE(frontend,
593159b3361Sopenharmony_ci  [  --disable-frontend      Do not build the lame executable [default=build]],
594159b3361Sopenharmony_ci    WITH_FRONTEND="${enableval}", WITH_FRONTEND=yes)
595159b3361Sopenharmony_ciif test "x${WITH_FRONTEND}" = "xyes"; then
596159b3361Sopenharmony_ci	WITH_FRONTEND=lame${ac_exeext}
597159b3361Sopenharmony_ci	AC_MSG_RESULT(yes)
598159b3361Sopenharmony_cielse
599159b3361Sopenharmony_ci	WITH_FRONTEND=
600159b3361Sopenharmony_ci	AC_MSG_RESULT(no)
601159b3361Sopenharmony_cifi
602159b3361Sopenharmony_ci
603159b3361Sopenharmony_ci
604159b3361Sopenharmony_ci
605159b3361Sopenharmony_ciAC_MSG_CHECKING(if mp3x is requested)
606159b3361Sopenharmony_ciAC_ARG_ENABLE(mp3x,
607159b3361Sopenharmony_ci  [  --enable-mp3x           Build GTK frame analyzer [default=no]],
608159b3361Sopenharmony_ci    WITH_MP3X="${enableval}", WITH_MP3X=no)
609159b3361Sopenharmony_ciif test "x${WITH_MP3X}" = "xyes"; then
610159b3361Sopenharmony_ci	WITH_MP3X=mp3x${ac_exeext}
611159b3361Sopenharmony_ci	AC_MSG_RESULT(yes)
612159b3361Sopenharmony_cielse
613159b3361Sopenharmony_ci	WITH_MP3X=
614159b3361Sopenharmony_ci	AC_MSG_RESULT(no)
615159b3361Sopenharmony_cifi
616159b3361Sopenharmony_ci
617159b3361Sopenharmony_ciif test "${HAVE_GTK}" = "no"; then
618159b3361Sopenharmony_ci	if test "x${WITH_MP3X}" = "xmp3x"; then
619159b3361Sopenharmony_ci		AC_MSG_WARN(can't build mp3x, no GTK installed)
620159b3361Sopenharmony_ci		WITH_MP3X=
621159b3361Sopenharmony_ci	fi
622159b3361Sopenharmony_ci	if test "x${CONFIG_ANALYZER}" != "xyes"; then
623159b3361Sopenharmony_ci		AC_MSG_WARN(can't build mp3x because of disabled analyzer hooks)
624159b3361Sopenharmony_ci		WITH_MP3X=
625159b3361Sopenharmony_ci	fi
626159b3361Sopenharmony_cifi
627159b3361Sopenharmony_ci
628159b3361Sopenharmony_ciAC_MSG_CHECKING(if mp3rtp is requested)
629159b3361Sopenharmony_ciAC_ARG_ENABLE(mp3rtp,
630159b3361Sopenharmony_ci  [  --enable-mp3rtp         Build mp3rtp [default=no]],
631159b3361Sopenharmony_ci    WITH_MP3RTP="${enableval}", WITH_MP3RTP=no)
632159b3361Sopenharmony_ciif test "x${WITH_MP3RTP}" = "xyes"; then
633159b3361Sopenharmony_ci	if test ${SOCKETFUNCTION} = NO; then
634159b3361Sopenharmony_ci		AC_MSG_ERROR([function socket is mandatory for mp3rtp])
635159b3361Sopenharmony_ci	fi
636159b3361Sopenharmony_ci	WITH_MP3RTP=mp3rtp${ac_exeext}
637159b3361Sopenharmony_ci	AC_MSG_RESULT(yes)
638159b3361Sopenharmony_cielse
639159b3361Sopenharmony_ci	WITH_MP3RTP=
640159b3361Sopenharmony_ci	AC_MSG_RESULT(no)
641159b3361Sopenharmony_cifi
642159b3361Sopenharmony_ci
643159b3361Sopenharmony_ciAC_MSG_CHECKING(if dynamic linking of the frontends is requested)
644159b3361Sopenharmony_ciAC_ARG_ENABLE(dynamic-frontends,
645159b3361Sopenharmony_ci  [  --enable-dynamic-frontends Link frontends against shared libraries [default=no]],
646159b3361Sopenharmony_ci    FRONTEND_LDFLAGS="${FRONTEND_LDFLAGS}", FRONTEND_LDFLAGS="${FRONTEND_LDFLAGS} -static")
647159b3361Sopenharmony_cicase "x${FRONTEND_LDFLAGS}" in
648159b3361Sopenharmony_ci*-static*)
649159b3361Sopenharmony_ci	AC_MSG_RESULT(no)
650159b3361Sopenharmony_ci	;;
651159b3361Sopenharmony_ci*)
652159b3361Sopenharmony_ci	AC_MSG_RESULT(yes)
653159b3361Sopenharmony_ci	;;
654159b3361Sopenharmony_ciesac
655159b3361Sopenharmony_ci
656159b3361Sopenharmony_ci
657159b3361Sopenharmony_ci#
658159b3361Sopenharmony_ci# this is from vorbis
659159b3361Sopenharmony_ci#
660159b3361Sopenharmony_cidnl check GLIBC
661159b3361Sopenharmony_cicase $host in
662159b3361Sopenharmony_ci*86-*-linux*)
663159b3361Sopenharmony_ci	# glibc < 2.1.3 has a serious FP bug in the math inline header
664159b3361Sopenharmony_ci	# that will cripple Vorbis.  Look to see if the magic FP stack
665159b3361Sopenharmony_ci	# clobber is missing in the mathinline header, thus indicating
666159b3361Sopenharmony_ci	# the buggy version
667159b3361Sopenharmony_ci
668159b3361Sopenharmony_ci	AC_EGREP_CPP(log10.*fldlg2.*fxch,[
669159b3361Sopenharmony_ci		#define __LIBC_INTERNAL_MATH_INLINES 1
670159b3361Sopenharmony_ci	     	#define __OPTIMIZE__
671159b3361Sopenharmony_ci		#include <math.h>
672159b3361Sopenharmony_ci		],bad=maybe,bad=no)
673159b3361Sopenharmony_ci
674159b3361Sopenharmony_ci	AC_MSG_CHECKING(glibc mathinline bug)
675159b3361Sopenharmony_ci	if test ${bad} = "maybe" ;then
676159b3361Sopenharmony_ci	      AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\),
677159b3361Sopenharmony_ci				[
678159b3361Sopenharmony_ci				#define __LIBC_INTERNAL_MATH_INLINES 1
679159b3361Sopenharmony_ci			     	#define __OPTIMIZE__
680159b3361Sopenharmony_ci				#include <math.h>
681159b3361Sopenharmony_ci				],bad=no,bad=yes)
682159b3361Sopenharmony_ci	fi
683159b3361Sopenharmony_ci	AC_MSG_RESULT(${bad})
684159b3361Sopenharmony_ci	if test ${bad} = "yes" ;then
685159b3361Sopenharmony_ci AC_MSG_WARN([                                                        ])
686159b3361Sopenharmony_ci AC_MSG_WARN([********************************************************])
687159b3361Sopenharmony_ci AC_MSG_WARN([* The glibc headers on this machine have a serious bug *])
688159b3361Sopenharmony_ci AC_MSG_WARN([* in /usr/include/bits/mathinline.h  This bug affects  *])
689159b3361Sopenharmony_ci AC_MSG_WARN([* all floating point code, not only LAME, but all code *])
690159b3361Sopenharmony_ci AC_MSG_WARN([* built on this machine. Upgrading to glibc 2.1.3 is   *])
691159b3361Sopenharmony_ci AC_MSG_WARN([* strongly urged to correct the problem.               *])
692159b3361Sopenharmony_ci AC_MSG_WARN([*Note: that upgrading glibc will not fix any previously*])
693159b3361Sopenharmony_ci AC_MSG_WARN([* built programs; this is a compile-time bug.          *])
694159b3361Sopenharmony_ci AC_MSG_WARN([* To work around the problem for this build of LAME,   *])
695159b3361Sopenharmony_ci AC_MSG_WARN([* autoconf is disabling all math inlining.  This will  *])
696159b3361Sopenharmony_ci AC_MSG_WARN([* hurt LAME performace but is necessary for LAME to    *])
697159b3361Sopenharmony_ci AC_MSG_WARN([* work correctly.  Once glibc is upgraded, rerun       *])
698159b3361Sopenharmony_ci AC_MSG_WARN([* configure and make to build with inlining.           *])
699159b3361Sopenharmony_ci AC_MSG_WARN([********************************************************])
700159b3361Sopenharmony_ci AC_MSG_WARN([                                                        ])
701159b3361Sopenharmony_ci
702159b3361Sopenharmony_ci	AC_DEFINE(__NO_MATH_INLINES, 1, work around a glibc bug)
703159b3361Sopenharmony_ci	fi;;
704159b3361Sopenharmony_ciesac
705159b3361Sopenharmony_ci
706159b3361Sopenharmony_ci
707159b3361Sopenharmony_cidnl configure use of VBR bitrate histogram
708159b3361Sopenharmony_cidnl todo: always use yes as default, use simulation instead ?
709159b3361Sopenharmony_ciAC_MSG_CHECKING(for termcap)
710159b3361Sopenharmony_ciif test "x${HAVE_TERMCAP}" != "x"; then
711159b3361Sopenharmony_ci  FRONTEND_LDADD="-l${HAVE_TERMCAP} ${FRONTEND_LDADD}"
712159b3361Sopenharmony_ci  AC_DEFINE(HAVE_TERMCAP, 1, have termcap)
713159b3361Sopenharmony_ci  TERMCAP_DEFAULT="yes"
714159b3361Sopenharmony_cielse
715159b3361Sopenharmony_ci  TERMCAP_DEFAULT="no"
716159b3361Sopenharmony_cifi
717159b3361Sopenharmony_ciAC_MSG_RESULT(${TERMCAP_DEFAULT})
718159b3361Sopenharmony_ci
719159b3361Sopenharmony_ci
720159b3361Sopenharmony_cidnl ### processor specific options ###
721159b3361Sopenharmony_ciWITH_VECTOR=no
722159b3361Sopenharmony_cicase $host_cpu in
723159b3361Sopenharmony_cix86_64|amd64)
724159b3361Sopenharmony_ci	CPUTYPE="no"
725159b3361Sopenharmony_ci	if test $ac_cv_header_xmmintrin_h = yes ; then
726159b3361Sopenharmony_ci		WITH_XMM=yes
727159b3361Sopenharmony_ci		WITH_VECTOR=yes
728159b3361Sopenharmony_ci	fi
729159b3361Sopenharmony_ci
730159b3361Sopenharmony_ci	AC_DEFINE(USE_FAST_LOG, 1, faster log implementation with less but enough precission)
731159b3361Sopenharmony_ci	;;
732159b3361Sopenharmony_ci*86)
733159b3361Sopenharmony_ci	CPUTYPE="i386"
734159b3361Sopenharmony_ci	if test $ac_cv_header_xmmintrin_h = yes ; then
735159b3361Sopenharmony_ci		WITH_XMM=yes
736159b3361Sopenharmony_ci		WITH_VECTOR=yes
737159b3361Sopenharmony_ci	fi
738159b3361Sopenharmony_ci
739159b3361Sopenharmony_ci	AC_DEFINE(USE_FAST_LOG, 1, faster log implementation with less but enough precission)
740159b3361Sopenharmony_ci	;;
741159b3361Sopenharmony_cipowerpc)
742159b3361Sopenharmony_ci	CPUTYPE="no"
743159b3361Sopenharmony_ci
744159b3361Sopenharmony_ci	# The following should not get enabled on a G5. HOWTO check for a G5?
745159b3361Sopenharmony_ci	AC_DEFINE(USE_FAST_LOG, 1, faster log implementation with less but enough precission)
746159b3361Sopenharmony_ci	;;
747159b3361Sopenharmony_ci*)
748159b3361Sopenharmony_ci	CPUTYPE="no"
749159b3361Sopenharmony_ci	;;
750159b3361Sopenharmony_ciesac
751159b3361Sopenharmony_ci
752159b3361Sopenharmony_ci# which vector code do we support to build on this machine?
753159b3361Sopenharmony_ciAM_CONDITIONAL(WITH_XMM, test "x${WITH_XMM}" = "xyes")
754159b3361Sopenharmony_ci
755159b3361Sopenharmony_ci# needs to be defined to link in the internal vector lib
756159b3361Sopenharmony_ciAM_CONDITIONAL(WITH_VECTOR, test "x${WITH_VECTOR}" = "xyes")
757159b3361Sopenharmony_ciAC_MSG_CHECKING(if I have to build the internal vector lib)
758159b3361Sopenharmony_ciAC_MSG_RESULT(${WITH_VECTOR})
759159b3361Sopenharmony_ci
760159b3361Sopenharmony_ci
761159b3361Sopenharmony_ciAC_PATH_PROG(NASM, nasm, no)
762159b3361Sopenharmony_cicase "${NASM}" in
763159b3361Sopenharmony_cino)
764159b3361Sopenharmony_ci	;;
765159b3361Sopenharmony_ci*)
766159b3361Sopenharmony_ci	AC_MSG_CHECKING(for assembler routines for this processor type)
767159b3361Sopenharmony_ci	for recurse_over in ${ASM_FOR_ARCH}
768159b3361Sopenharmony_ci	do
769159b3361Sopenharmony_ci		if test "${CPUTYPE}" = "${recurse_over}"; then
770159b3361Sopenharmony_ci			include_asm_routines="yes"
771159b3361Sopenharmony_ci		fi
772159b3361Sopenharmony_ci
773159b3361Sopenharmony_ci		case $host_os in
774159b3361Sopenharmony_ci		*darwin*)
775159b3361Sopenharmony_ci			# currently we have problems because of a wrong
776159b3361Sopenharmony_ci			# libtool hack in the darwin case (for nasm code)
777159b3361Sopenharmony_ci			include_asm_routines="no"
778159b3361Sopenharmony_ci			;;
779159b3361Sopenharmony_ci		esac
780159b3361Sopenharmony_ci	done
781159b3361Sopenharmony_ci	if test "x${include_asm_routines}" = "xyes"; then
782159b3361Sopenharmony_ci		AC_DEFINE(HAVE_NASM, 1, have nasm)
783159b3361Sopenharmony_ci		AC_DEFINE(MMX_choose_table, 1, use MMX version of choose_table)
784159b3361Sopenharmony_ci	else
785159b3361Sopenharmony_ci		include_asm_routines="no"
786159b3361Sopenharmony_ci		NASM="no"
787159b3361Sopenharmony_ci	fi
788159b3361Sopenharmony_ci	AC_MSG_RESULT(${include_asm_routines})
789159b3361Sopenharmony_ci	;;
790159b3361Sopenharmony_ciesac
791159b3361Sopenharmony_ciAM_CONDITIONAL(HAVE_NASM, test "${NASM}" != "no")
792159b3361Sopenharmony_ci
793159b3361Sopenharmony_cicase $host_os in
794159b3361Sopenharmony_ci	*cygwin*|*mingw32*)
795159b3361Sopenharmony_ci		CYGWIN=yes
796159b3361Sopenharmony_ci		NASM_FORMAT="-f win32 -DWIN32"
797159b3361Sopenharmony_ci		;;
798159b3361Sopenharmony_ci	*darwin*)
799159b3361Sopenharmony_ci		NASM_FORMAT="-f macho"
800159b3361Sopenharmony_ci		;;
801159b3361Sopenharmony_ci	*os2-emx*)
802159b3361Sopenharmony_ci		NASM_FORMAT="-f aout -DAOUT"
803159b3361Sopenharmony_ci		;;
804159b3361Sopenharmony_ci	*)
805159b3361Sopenharmony_ci		CYGWIN=no
806159b3361Sopenharmony_ci		NASM_FORMAT="-f elf"
807159b3361Sopenharmony_ci		;;
808159b3361Sopenharmony_ciesac
809159b3361Sopenharmony_ci
810159b3361Sopenharmony_ci#
811159b3361Sopenharmony_ci# 'expopt' is used for "additional optimizations", not for optimizations which
812159b3361Sopenharmony_ci# are marked as "experimental" in the guide for the compiler.
813159b3361Sopenharmony_ci# They are "experimental" here in the LAME project (at least
814159b3361Sopenharmony_ci# "--enable-expopt=full").
815159b3361Sopenharmony_ci#
816159b3361Sopenharmony_ciAC_MSG_CHECKING(for additional optimizations)
817159b3361Sopenharmony_ciAC_ARG_ENABLE(expopt,
818159b3361Sopenharmony_ci  [  --enable-expopt=full,norm Whether to enable experimental optimizations]
819159b3361Sopenharmony_ci  [                          [default=no]],
820159b3361Sopenharmony_ci    CONFIG_EXPOPT="${enableval}", CONFIG_EXPOPT="no")
821159b3361Sopenharmony_ci
822159b3361Sopenharmony_ciif test "x$HAVE_GCC" = "xyes" -o "x$HAVE_CLANG" = "xyes"; then
823159b3361Sopenharmony_ci	# gcc defaults. OS specific options go in versious sections below
824159b3361Sopenharmony_ci	# from the gcc man pages:  "there is no reason to use -pedantic"
825159b3361Sopenharmony_ci	if test "x${with_gnu_ld}" = "xyes"; then
826159b3361Sopenharmony_ci		CFLAGS="-Wall -pipe ${CFLAGS}"
827159b3361Sopenharmony_ci	else
828159b3361Sopenharmony_ci		# some vendor ld's don't like '-pipe'
829159b3361Sopenharmony_ci		CFLAGS="-Wall ${CFLAGS}"
830159b3361Sopenharmony_ci	fi
831159b3361Sopenharmony_ci
832159b3361Sopenharmony_ci	# GCC version specific generic options
833159b3361Sopenharmony_ci	if test "x${HAVE_GCC}" = "xyes"; then
834159b3361Sopenharmony_ci		case "${GCC_version}" in
835159b3361Sopenharmony_ci		2.96*)
836159b3361Sopenharmony_ci        		# for buggy version of gcc shipped with RH7.1, back of on some
837159b3361Sopenharmony_ci        		# optimizations
838159b3361Sopenharmony_ci        		OPTIMIZATION="-O -fomit-frame-pointer -ffast-math \
839159b3361Sopenharmony_ci				-funroll-loops"
840159b3361Sopenharmony_ci			OPTIMIZATION_FULL="-fmove-all-movables -freduce-all-givs \
841159b3361Sopenharmony_ci				-fsched-interblock -fbranch-count-reg -fforce-addr \
842159b3361Sopenharmony_ci				-fforce-mem"
843159b3361Sopenharmony_ci        		;;
844159b3361Sopenharmony_ci		3.0*)
845159b3361Sopenharmony_ci			# -funroll-loops seems to produce buggy code with gcc 3.0.3
846159b3361Sopenharmony_ci			OPTIMIZATION="-O -fomit-frame-pointer -ffast-math"
847159b3361Sopenharmony_ci			OPTIMIZATION_FULL="-fmove-all-movables -freduce-all-givs \
848159b3361Sopenharmony_ci				-fbranch-count-reg -fforce-addr -fforce-mem"
849159b3361Sopenharmony_ci			;;
850159b3361Sopenharmony_ci		3.*|4.0.*|4.1.*)
851159b3361Sopenharmony_ci			# -fomit-frame-pointer seems to be buggy on cygwin
852159b3361Sopenharmony_ci			case ${host_os} in
853159b3361Sopenharmony_ci			*cygwin*)
854159b3361Sopenharmony_ci				OMIT_FRAME_POINTER=
855159b3361Sopenharmony_ci				;;
856159b3361Sopenharmony_ci			*)
857159b3361Sopenharmony_ci				OMIT_FRAME_POINTER=-fomit-frame-pointer
858159b3361Sopenharmony_ci				;;
859159b3361Sopenharmony_ci			esac
860159b3361Sopenharmony_ci	
861159b3361Sopenharmony_ci			OPTIMIZATION="-O3 ${OMIT_FRAME_POINTER} -ffast-math"
862159b3361Sopenharmony_ci			OPTIMIZATION_FULL="-fmove-all-movables -freduce-all-givs \
863159b3361Sopenharmony_ci				-fbranch-count-reg -fforce-addr -fforce-mem"
864159b3361Sopenharmony_ci			;;
865159b3361Sopenharmony_ci		[[456789]].*|1[[0-9]].*)
866159b3361Sopenharmony_ci			OPTIMIZATION="-O3 -fomit-frame-pointer -ffast-math"
867159b3361Sopenharmony_ci			OPTIMIZATION_FULL="-fbranch-count-reg -fforce-addr"
868159b3361Sopenharmony_ci			;;
869159b3361Sopenharmony_ci		*)
870159b3361Sopenharmony_ci			# default
871159b3361Sopenharmony_ci			OPTIMIZATION="-O3 ${OMIT_FRAME_POINTER} -ffast-math \
872159b3361Sopenharmony_ci				-funroll-loops"
873159b3361Sopenharmony_ci			OPTIMIZATION_FULL="-fbranch-count-reg -fforce-addr"
874159b3361Sopenharmony_ci			;;
875159b3361Sopenharmony_ci		esac
876159b3361Sopenharmony_ci
877159b3361Sopenharmony_ci		# GCC version independend generic options
878159b3361Sopenharmony_ci		OPTIMIZATION_NORM="-fschedule-insns2"
879159b3361Sopenharmony_ci	fi
880159b3361Sopenharmony_ci
881159b3361Sopenharmony_ci
882159b3361Sopenharmony_ci	# generic CPU specific options
883159b3361Sopenharmony_ci	case ${host_cpu} in
884159b3361Sopenharmony_ci	sparc)
885159b3361Sopenharmony_ci		case "${GCC_version}" in
886159b3361Sopenharmony_ci		3.0*)
887159b3361Sopenharmony_ci			;;
888159b3361Sopenharmony_ci		[[3456789]].*|1[[0-9]].*)
889159b3361Sopenharmony_ci			# doesn't work on 3.0.x, but on 3.[12] and
890159b3361Sopenharmony_ci			# hopefully on every other release after that too
891159b3361Sopenharmony_ci			if test -x /usr/bin/isalist; then
892159b3361Sopenharmony_ci				/usr/bin/isalist | grep sparcv8plus \
893159b3361Sopenharmony_ci					>/dev/null 2>&1 && \
894159b3361Sopenharmony_ci					OPTIMIZATION="${OPTIMIZATION} \
895159b3361Sopenharmony_ci						-mcpu=ultrasparc \
896159b3361Sopenharmony_ci						-mtune=ultrasparc"
897159b3361Sopenharmony_ci			fi
898159b3361Sopenharmony_ci			;;
899159b3361Sopenharmony_ci		esac
900159b3361Sopenharmony_ci		;;
901159b3361Sopenharmony_ci	*86)
902159b3361Sopenharmony_ci		case "${GCC_version}" in
903159b3361Sopenharmony_ci		[[3456789]].*|1[[0-9]].*)
904159b3361Sopenharmony_ci			OPTIMIZATION="${OPTIMIZATION} \
905159b3361Sopenharmony_ci				-maccumulate-outgoing-args"
906159b3361Sopenharmony_ci			;;
907159b3361Sopenharmony_ci		esac
908159b3361Sopenharmony_ci		;;
909159b3361Sopenharmony_ci	esac
910159b3361Sopenharmony_ci
911159b3361Sopenharmony_ci	expopt_msg_result_printed=no
912159b3361Sopenharmony_ci	case "${CONFIG_EXPOPT}" in
913159b3361Sopenharmony_ci	no)
914159b3361Sopenharmony_ci		# if someone supplies own CFLAGS, we don't add our own
915159b3361Sopenharmony_ci		if test "x${ac_save_CFLAGS}" != "x"; then
916159b3361Sopenharmony_ci			OPTIMIZATION=""
917159b3361Sopenharmony_ci		fi
918159b3361Sopenharmony_ci		;;
919159b3361Sopenharmony_ci	norm|yes)
920159b3361Sopenharmony_ci		OPTIMIZATION="${OPTIMIZATION} ${OPTIMIZATION_NORM}"
921159b3361Sopenharmony_ci		;;
922159b3361Sopenharmony_ci	full)
923159b3361Sopenharmony_ci		OPTIMIZATION="${OPTIMIZATION} ${OPTIMIZATION_NORM} \
924159b3361Sopenharmony_ci			${OPTIMIZATION_FULL}"
925159b3361Sopenharmony_ci
926159b3361Sopenharmony_ci		if test "${HAVE_GCC}" = "yes"; then
927159b3361Sopenharmony_ci			# some hardware dependend options
928159b3361Sopenharmony_ci			case "${GCC_version}" in
929159b3361Sopenharmony_ci			2.9*|3.*|4.0.*|4.1.*)
930159b3361Sopenharmony_ci				# "new" GCC, use some "new" CPU specific optimizations
931159b3361Sopenharmony_ci				# use -mtune instead of -m486 or -mcpu= etc, since they are
932159b3361Sopenharmony_ci				# deprecated by GCC <rbrito>
933159b3361Sopenharmony_ci				case ${host_cpu} in
934159b3361Sopenharmony_ci				*486)
935159b3361Sopenharmony_ci					OPTIMIZATION="${OPTIMIZATION} -mcpu=i486 \
936159b3361Sopenharmony_ci						-mfancy-math-387"
937159b3361Sopenharmony_ci					;;
938159b3361Sopenharmony_ci				*586)
939159b3361Sopenharmony_ci					OPTIMIZATION="${OPTIMIZATION} -mcpu=pentium \
940159b3361Sopenharmony_ci						-march=pentium -mfancy-math-387"
941159b3361Sopenharmony_ci					;;
942159b3361Sopenharmony_ci				*686)
943159b3361Sopenharmony_ci					OPTIMIZATION="${OPTIMIZATION} -mcpu=pentiumpro \
944159b3361Sopenharmony_ci						-march=pentiumpro -mfancy-math-387 \
945159b3361Sopenharmony_ci						-malign-double"
946159b3361Sopenharmony_ci					;;
947159b3361Sopenharmony_ci				*86)
948159b3361Sopenharmony_ci					OPTIMIZATION="${OPTIMIZATION} -mfancy-math-387"
949159b3361Sopenharmony_ci					;;
950159b3361Sopenharmony_ci				alpha*)
951159b3361Sopenharmony_ci					OPTIMIZATION="${OPTIMIZATION} -mfp-regs"
952159b3361Sopenharmony_ci					AC_DEFINE(FLOAT, double, double is faster than float on Alpha)
953159b3361Sopenharmony_ci					# add "-mcpu=21164a -Wa,-m21164a" to optimize
954159b3361Sopenharmony_ci					# for 21164a (ev56) CPU
955159b3361Sopenharmony_ci					;;
956159b3361Sopenharmony_ci				*)
957159b3361Sopenharmony_ci					OPTIMIZATION="${OPTIMIZATION} -fdelayed-branch"
958159b3361Sopenharmony_ci					;;
959159b3361Sopenharmony_ci				esac
960159b3361Sopenharmony_ci				;;
961159b3361Sopenharmony_ci			[[456789]].*|1[[0-9]].*)
962159b3361Sopenharmony_ci				case ${host_cpu} in
963159b3361Sopenharmony_ci				*486)
964159b3361Sopenharmony_ci					OPTIMIZATION="${OPTIMIZATION} -march=i486"
965159b3361Sopenharmony_ci					;;
966159b3361Sopenharmony_ci				*586)
967159b3361Sopenharmony_ci					OPTIMIZATION="${OPTIMIZATION} -march=i586 \
968159b3361Sopenharmony_ci						-mtune=native"
969159b3361Sopenharmony_ci					;;
970159b3361Sopenharmony_ci				*686)
971159b3361Sopenharmony_ci					OPTIMIZATION="${OPTIMIZATION} -march=i686 \
972159b3361Sopenharmony_ci						-mtune=native"
973159b3361Sopenharmony_ci					;;
974159b3361Sopenharmony_ci				*86)
975159b3361Sopenharmony_ci					OPTIMIZATION="${OPTIMIZATION} -march=native \
976159b3361Sopenharmony_ci						-mtune=native"
977159b3361Sopenharmony_ci					;;
978159b3361Sopenharmony_ci				arm*-gnueabi)
979159b3361Sopenharmony_ci					if [ -z "$(echo ${GCC_version} | awk '/4\.0/')" ]; then
980159b3361Sopenharmony_ci						# Work round buggy softfloat optimization in ARM EABI compilers
981159b3361Sopenharmony_ci						# -gnueabi in only gcc-4.1 onwards
982159b3361Sopenharmony_ci						OPTIMIZATION="${OPTIMIZATION} -fno-finite-math-only"
983159b3361Sopenharmony_ci					fi
984159b3361Sopenharmony_ci					;;
985159b3361Sopenharmony_ci				esac
986159b3361Sopenharmony_ci				;;
987159b3361Sopenharmony_ci			*)
988159b3361Sopenharmony_ci				# no special optimization for other versions
989159b3361Sopenharmony_ci				AC_MSG_RESULT(no)
990159b3361Sopenharmony_ci				expopt_msg_result_printed=yes
991159b3361Sopenharmony_ci				AC_MSG_WARN(LAME doesn't know about your version (${GCC_version}) of gcc, please report it to lame-dev@lists.sourceforge.net. Please make sure you try the latest LAME version first!)
992159b3361Sopenharmony_ci				;;
993159b3361Sopenharmony_ci			esac
994159b3361Sopenharmony_ci		fi
995159b3361Sopenharmony_ci		;;
996159b3361Sopenharmony_ci	*)
997159b3361Sopenharmony_ci		AC_MSG_ERROR(bad value �${CONFIG_EXPOPT}� for expopt option)
998159b3361Sopenharmony_ci		;;
999159b3361Sopenharmony_ci	esac
1000159b3361Sopenharmony_ci
1001159b3361Sopenharmony_ci
1002159b3361Sopenharmony_ci	if test "x${HAVE_CLANG}" = "xyes"; then
1003159b3361Sopenharmony_ci		case "${CLANG_VERSION}" in
1004159b3361Sopenharmony_ci		3.[[89]]*|[[45]].*|1[[0-9]].*)
1005159b3361Sopenharmony_ci			OPTIMIZATION="-Ofast"
1006159b3361Sopenharmony_ci			;;
1007159b3361Sopenharmony_ci		*)
1008159b3361Sopenharmony_ci			OPTIMIZATION="-O3"
1009159b3361Sopenharmony_ci			;;
1010159b3361Sopenharmony_ci		esac
1011159b3361Sopenharmony_ci
1012159b3361Sopenharmony_ci		# generic CPU specific options
1013159b3361Sopenharmony_ci		case ${host_cpu} in
1014159b3361Sopenharmony_ci		*486)
1015159b3361Sopenharmony_ci			OPTIMIZATION="${OPTIMIZATION} -march=i486"
1016159b3361Sopenharmony_ci			;;
1017159b3361Sopenharmony_ci		*586)
1018159b3361Sopenharmony_ci			OPTIMIZATION="${OPTIMIZATION} -march=i586 \
1019159b3361Sopenharmony_ci				-mtune=native"
1020159b3361Sopenharmony_ci			;;
1021159b3361Sopenharmony_ci		*686)
1022159b3361Sopenharmony_ci			OPTIMIZATION="${OPTIMIZATION} -march=i686 \
1023159b3361Sopenharmony_ci				-mtune=native"
1024159b3361Sopenharmony_ci			;;
1025159b3361Sopenharmony_ci		*86)
1026159b3361Sopenharmony_ci			OPTIMIZATION="${OPTIMIZATION} -march=native \
1027159b3361Sopenharmony_ci				-mtune=native"
1028159b3361Sopenharmony_ci			;;
1029159b3361Sopenharmony_ci		esac
1030159b3361Sopenharmony_ci
1031159b3361Sopenharmony_ci	fi
1032159b3361Sopenharmony_ci
1033159b3361Sopenharmony_ci
1034159b3361Sopenharmony_ci	if test "${expopt_msg_result_printed}" = "no" ; then
1035159b3361Sopenharmony_ci		AC_MSG_RESULT(${CONFIG_EXPOPT})
1036159b3361Sopenharmony_ci	fi
1037159b3361Sopenharmony_cielse
1038159b3361Sopenharmony_ci	AC_MSG_RESULT(no)
1039159b3361Sopenharmony_cifi
1040159b3361Sopenharmony_ci
1041159b3361Sopenharmony_ci
1042159b3361Sopenharmony_ci
1043159b3361Sopenharmony_ci
1044159b3361Sopenharmony_ci
1045159b3361Sopenharmony_ciAC_MSG_CHECKING(for debug options)
1046159b3361Sopenharmony_ciAC_ARG_ENABLE(debug,
1047159b3361Sopenharmony_ci  [  --enable-debug=alot,norm Enable debugging (disables optimizations)]
1048159b3361Sopenharmony_ci  [                         [default=no]],
1049159b3361Sopenharmony_ci    CONFIG_DEBUG="${enableval}", CONFIG_DEBUG="no")
1050159b3361Sopenharmony_ci
1051159b3361Sopenharmony_ciif test "x$GCC" = "xyes"; then
1052159b3361Sopenharmony_ci	DEBUG_NORM_OPT="-O -g -Wall"
1053159b3361Sopenharmony_ci	DEBUG_ANOYING="-Wbad-function-cast -Wcast-align \
1054159b3361Sopenharmony_ci		-Wcast-qual -Wchar-subscripts -Wconversion \
1055159b3361Sopenharmony_ci		-Wmissing-prototypes -Wnested-externs -Wpointer-arith \
1056159b3361Sopenharmony_ci		-Wredundant-decls -Wshadow -Wstrict-prototypes \
1057159b3361Sopenharmony_ci		-Wwrite-strings -Winline \
1058159b3361Sopenharmony_ci		-Wformat -Wswitch -Waggregate-return -Wmissing-noreturn \
1059159b3361Sopenharmony_ci		-Wimplicit-int -fno-builtin"
1060159b3361Sopenharmony_ci
1061159b3361Sopenharmony_ci	case "${CONFIG_DEBUG}" in
1062159b3361Sopenharmony_ci	no)
1063159b3361Sopenharmony_cidnl	Comment out the NDEBUG on release build, they check for issues
1064159b3361Sopenharmony_cidnl	which should also be rejected in a release build.
1065159b3361Sopenharmony_cidnl	The real solution would be to do user friendly error messages
1066159b3361Sopenharmony_cidnl	instead of a core dump. This is a quick and user-unfriendly fix.
1067159b3361Sopenharmony_cidnl		AC_DEFINE(NDEBUG, 1, no debug build)
1068159b3361Sopenharmony_ci		;;
1069159b3361Sopenharmony_ci	norm|yes)
1070159b3361Sopenharmony_ci		AC_DEFINE(ABORTFP, 1, debug define)
1071159b3361Sopenharmony_ci		OPTIMIZATION="${DEBUG_NORM_OPT}"
1072159b3361Sopenharmony_ci		;;
1073159b3361Sopenharmony_ci	anoying)
1074159b3361Sopenharmony_ci		AC_DEFINE(ABORTFP, 1, debug define)
1075159b3361Sopenharmony_ci		OPTIMIZATION="${DEBUG_NORM_OPT} ${DEBUG_ANOYING}"
1076159b3361Sopenharmony_ci		;;
1077159b3361Sopenharmony_ci	alot)
1078159b3361Sopenharmony_ci		AC_DEFINE(ABORTFP, 1, debug define)
1079159b3361Sopenharmony_ci		AC_DEFINE(DEBUG, 1, alot of debug output)
1080159b3361Sopenharmony_ci		OPTIMIZATION="${DEBUG_NORM_OPT}"
1081159b3361Sopenharmony_ci		;;
1082159b3361Sopenharmony_ci	*)
1083159b3361Sopenharmony_ci		AC_MSG_ERROR(bad value �${CONFIG_DEBUG}� for debug option)
1084159b3361Sopenharmony_ci	esac
1085159b3361Sopenharmony_ci
1086159b3361Sopenharmony_ci	AC_MSG_RESULT(${CONFIG_DEBUG})
1087159b3361Sopenharmony_cielse
1088159b3361Sopenharmony_ci	AC_MSG_RESULT(no)
1089159b3361Sopenharmony_cifi
1090159b3361Sopenharmony_ci
1091159b3361Sopenharmony_ci
1092159b3361Sopenharmony_ci
1093159b3361Sopenharmony_cidnl ###  system specific options  ###
1094159b3361Sopenharmony_ci
1095159b3361Sopenharmony_ci##########################################################################
1096159b3361Sopenharmony_ci# LINUX on Digital/Compaq Alpha CPUs
1097159b3361Sopenharmony_ci##########################################################################
1098159b3361Sopenharmony_cicase $host in
1099159b3361Sopenharmony_cialpha*-*-linux*)
1100159b3361Sopenharmony_ci
1101159b3361Sopenharmony_ci################################################################
1102159b3361Sopenharmony_ci#### Check if 'ccc' is in our path
1103159b3361Sopenharmony_ci################################################################
1104159b3361Sopenharmony_ciif test "`which ccc 2>/dev/null | grep -c ccc`" != "0" ; then
1105159b3361Sopenharmony_ci	# Compaq's C Compiler
1106159b3361Sopenharmony_ci	CC=ccc
1107159b3361Sopenharmony_ci
1108159b3361Sopenharmony_ci################################################################
1109159b3361Sopenharmony_ci#### set 'OPTIMIZATION = -arch host -tune host'
1110159b3361Sopenharmony_ci####              to generate/tune instructions for this machine
1111159b3361Sopenharmony_ci####     'OPTIMIZATION += -migrate -fast -inline speed -unroll 0'
1112159b3361Sopenharmony_ci####              tweak to run as fast as possible :)
1113159b3361Sopenharmony_ci####     'OPTIMIZATION += -w0'
1114159b3361Sopenharmony_ci####              set warning and linking flags
1115159b3361Sopenharmony_ci################################################################
1116159b3361Sopenharmony_ci	OPTIMIZATION="-arch host -tune host"
1117159b3361Sopenharmony_ci	OPTIMIZATION="-migrate -fast -inline speed -unroll 0 $OPTIMIZATION"
1118159b3361Sopenharmony_ci	OPTIMIZATION="-w0 $OPTIMIZATION"
1119159b3361Sopenharmony_ci
1120159b3361Sopenharmony_ci
1121159b3361Sopenharmony_ci################################################################
1122159b3361Sopenharmony_ci#### to debug, uncomment
1123159b3361Sopenharmony_ci################################################################
1124159b3361Sopenharmony_ci	# For Debugging
1125159b3361Sopenharmony_ci	#OPTIMIZATION="-g3 $OPTIMIZATION"
1126159b3361Sopenharmony_ci
1127159b3361Sopenharmony_ci################################################################
1128159b3361Sopenharmony_ci#### define __DECALPHA__ (i was getting re-declaration warnings
1129159b3361Sopenharmony_ci####   in machine.h
1130159b3361Sopenharmony_ci################################################################
1131159b3361Sopenharmony_ci	# Define DEC Alpha
1132159b3361Sopenharmony_ci	AC_DEFINE(__DECALPHA__, 1, we're on DEC Alpha)
1133159b3361Sopenharmony_cifi  #  gcc or ccc?
1134159b3361Sopenharmony_ci;; # alpha
1135159b3361Sopenharmony_ci
1136159b3361Sopenharmony_ci
1137159b3361Sopenharmony_ci##########################################################################
1138159b3361Sopenharmony_ci# SunOS
1139159b3361Sopenharmony_ci##########################################################################
1140159b3361Sopenharmony_cisparc-*-sunos4*)
1141159b3361Sopenharmony_ci	if test CC = "cc"; then
1142159b3361Sopenharmony_ci		OPTIMIZATION="-O -xCC"
1143159b3361Sopenharmony_ci		MAKEDEP="-xM"
1144159b3361Sopenharmony_ci		# for gcc, use instead:
1145159b3361Sopenharmony_ci		#   CC="gcc"
1146159b3361Sopenharmony_ci		#   OPTIMIZATION="-O"
1147159b3361Sopenharmony_ci		#   MAKEDEP="-M"
1148159b3361Sopenharmony_ciAC_MSG_WARN([Please contact lame@lists.sourceforge.net with the output of the configure run and the file config.cache. Thank you for your cooperation.])
1149159b3361Sopenharmony_ci	fi
1150159b3361Sopenharmony_ci;; #SunOS
1151159b3361Sopenharmony_ci
1152159b3361Sopenharmony_ci##########################################################################
1153159b3361Sopenharmony_ci# SGI
1154159b3361Sopenharmony_ci##########################################################################
1155159b3361Sopenharmony_ci*-sgi-irix*)
1156159b3361Sopenharmony_ci	if test CC = "cc"; then
1157159b3361Sopenharmony_ci		OPTIMIZATION="-O3 -woff all"
1158159b3361Sopenharmony_ci	fi
1159159b3361Sopenharmony_ci;; # SGI
1160159b3361Sopenharmony_ci
1161159b3361Sopenharmony_ci##########################################################################
1162159b3361Sopenharmony_ci# Compaq Alpha running Dec Unix (OSF)
1163159b3361Sopenharmony_ci##########################################################################
1164159b3361Sopenharmony_cialpha*-dec-osf*)
1165159b3361Sopenharmony_ci	if test CC = "cc"; then
1166159b3361Sopenharmony_ci		OPTIMIZATION="-fast -O3 -std -g3 -non_shared"
1167159b3361Sopenharmony_ci	fi
1168159b3361Sopenharmony_ci;; #OSF
1169159b3361Sopenharmony_ciesac
1170159b3361Sopenharmony_ci
1171159b3361Sopenharmony_ci# todo: include the following tests in the case-list
1172159b3361Sopenharmony_ciUNAME=`uname`
1173159b3361Sopenharmony_ciARCH=`uname -m`
1174159b3361Sopenharmony_ci
1175159b3361Sopenharmony_ci###########################################################################
1176159b3361Sopenharmony_ci# MOSXS (Rhapsody PPC)
1177159b3361Sopenharmony_ci###########################################################################
1178159b3361Sopenharmony_ciif test "$UNAME" = "Rhapsody"; then
1179159b3361Sopenharmony_ci#   CC="cc"   # should be handled already by autoconf
1180159b3361Sopenharmony_ci   MAKEDEP="-make"
1181159b3361Sopenharmony_cifi
1182159b3361Sopenharmony_ci
1183159b3361Sopenharmony_ci###########################################################################
1184159b3361Sopenharmony_ci# MAC OSX  Darwin PPC
1185159b3361Sopenharmony_ci###########################################################################
1186159b3361Sopenharmony_ciif test "$UNAME" = "Darwin"; then
1187159b3361Sopenharmony_ci   MAKEDEP="-make"
1188159b3361Sopenharmony_ci   CFLAGS="$CFLAGS -fno-common"
1189159b3361Sopenharmony_cifi
1190159b3361Sopenharmony_ci
1191159b3361Sopenharmony_ci
1192159b3361Sopenharmony_ci##########################################################################
1193159b3361Sopenharmony_ci# OS/2
1194159b3361Sopenharmony_ci##########################################################################
1195159b3361Sopenharmony_ci# Properly installed EMX runtime & development package is a prerequisite.
1196159b3361Sopenharmony_ci# tools I used: make 3.76.1, uname 1.12, sed 2.05, PD-ksh 5.2.13
1197159b3361Sopenharmony_ci#
1198159b3361Sopenharmony_ci##########################################################################
1199159b3361Sopenharmony_ciif test "$UNAME" = "OS/2"; then
1200159b3361Sopenharmony_ci   SHELL=sh
1201159b3361Sopenharmony_ci   #CC=gcc # should already be handled by configure
1202159b3361Sopenharmony_ci
1203159b3361Sopenharmony_ci   # file extension should already be handled by automake (I don't know,
1204159b3361Sopenharmony_ci   # please  give feedback!
1205159b3361Sopenharmony_ci   #FILE_EXTENSION=".exe"
1206159b3361Sopenharmony_ci
1207159b3361Sopenharmony_ci# Uncomment & inspect the GTK lines to use MP3x GTK frame analyzer.
1208159b3361Sopenharmony_ci# Properly installed XFree86/devlibs & GTK+ is a prerequisite.
1209159b3361Sopenharmony_ci# The following works for me using Xfree86/OS2 3.3.5 and GTK+ 1.2.3:
1210159b3361Sopenharmony_ci#   AC_DEFINE(HAVE_GTK, 1, have GTK)
1211159b3361Sopenharmony_ci#   AC_DEFINE(__ST_MT_ERRNO__, 1)
1212159b3361Sopenharmony_ci#   INCLUDES="-IC:/XFree86/include/gtk12 -IC:/XFree86/include/glib12 \
1213159b3361Sopenharmony_ci#             -IC:/XFree86/include $INCLUDES"
1214159b3361Sopenharmony_ci#   FRONTEND_LDFLAGS="-LC:/XFree86/lib -lgtk12 -lgdk12 -lgmodule -lglib12 \
1215159b3361Sopenharmony_ci#             -lXext -lX11 -lshm -lbsd -lsocket -lm $FRONTEND_LDFLAGS"
1216159b3361Sopenharmony_ci#   FRONTEND_CFLAGS="-Zmtd -Zsysv-signals -Zbin-files $FRONTEND_CFLAGS"
1217159b3361Sopenharmony_cifi
1218159b3361Sopenharmony_ci
1219159b3361Sopenharmony_ci###########################################################################
1220159b3361Sopenharmony_ci# AmigaOS
1221159b3361Sopenharmony_ci###########################################################################
1222159b3361Sopenharmony_ci# Type 'Make ARCH=PPC' for PowerUP and 'Make ARCH=WOS' for WarpOS
1223159b3361Sopenharmony_ci#
1224159b3361Sopenharmony_ci###########################################################################
1225159b3361Sopenharmony_ciif test "$UNAME" = "AmigaOS" ; then
1226159b3361Sopenharmony_ci	CC="gcc -noixemul"
1227159b3361Sopenharmony_ci	OPTIMIZATION="$OPTIMIZATION -m68020-60 -m68881"
1228159b3361Sopenharmony_ci	MAKEDEP="-MM"
1229159b3361Sopenharmony_ci	if test "$ARCH" = "WOS"; then
1230159b3361Sopenharmony_ci		CC="ppc-amigaos-gcc -warpup"
1231159b3361Sopenharmony_ci		OPTIMIZATION="$OPTIMIZATION -mmultiple -mcpu=603e"
1232159b3361Sopenharmony_ci		AR="ppc-amigaos-ar"
1233159b3361Sopenharmony_ci		RANLIB="ppc-amigaos-ranlib"
1234159b3361Sopenharmony_ci	fi
1235159b3361Sopenharmony_ci	if test "$ARCH",PPC; then
1236159b3361Sopenharmony_ci		CC="ppc-amigaos-gcc"
1237159b3361Sopenharmony_ci		OPTIMIZATION="$OPTIMIZATION -mmultiple -mcpu=603e"
1238159b3361Sopenharmony_ci		AR="ppc-amigaos-ar"
1239159b3361Sopenharmony_ci		RANLIB="ppc-amigaos-ranlib"
1240159b3361Sopenharmony_ci	fi
1241159b3361Sopenharmony_cifi
1242159b3361Sopenharmony_ci
1243159b3361Sopenharmony_ci
1244159b3361Sopenharmony_ciCFLAGS="${OPTIMIZATION} ${CFLAGS}"
1245159b3361Sopenharmony_ciLDADD="${LDADD}"
1246159b3361Sopenharmony_ciFRONTEND_CFLAGS="${INCICONV} ${FRONTEND_CFLAGS}"
1247159b3361Sopenharmony_ciFRONTEND_LDADD="${FRONTEND_LDADD} ${LTLIBICONV} ${CONFIG_MATH_LIB}"
1248159b3361Sopenharmony_ci
1249159b3361Sopenharmony_ci
1250159b3361Sopenharmony_ciAC_SUBST(INCLUDES)
1251159b3361Sopenharmony_ci
1252159b3361Sopenharmony_ciAC_SUBST(FRONTEND_LDFLAGS)
1253159b3361Sopenharmony_ciAC_SUBST(FRONTEND_CFLAGS)
1254159b3361Sopenharmony_ciAC_SUBST(FRONTEND_LDADD)
1255159b3361Sopenharmony_ciAC_SUBST(LIBMP3LAME_LDADD)
1256159b3361Sopenharmony_ciAC_SUBST(CONFIG_MATH_LIB)
1257159b3361Sopenharmony_ciAC_SUBST(LDADD)
1258159b3361Sopenharmony_ci
1259159b3361Sopenharmony_ciAC_SUBST(LIB_MAJOR_VERSION)
1260159b3361Sopenharmony_ciAC_SUBST(LIB_MINOR_VERSION)
1261159b3361Sopenharmony_ci
1262159b3361Sopenharmony_ciAC_SUBST(NASM)
1263159b3361Sopenharmony_ciAC_SUBST(NASM_FORMAT)
1264159b3361Sopenharmony_ci
1265159b3361Sopenharmony_ciAC_SUBST(MAKEDEP)
1266159b3361Sopenharmony_ciAC_SUBST(RM_F)
1267159b3361Sopenharmony_ci
1268159b3361Sopenharmony_ciAC_SUBST(LIBTOOL_DEPS)
1269159b3361Sopenharmony_ci
1270159b3361Sopenharmony_ciAC_SUBST(WITH_FRONTEND)
1271159b3361Sopenharmony_ciAC_SUBST(WITH_MP3X)
1272159b3361Sopenharmony_ciAC_SUBST(WITH_MP3RTP)
1273159b3361Sopenharmony_ci
1274159b3361Sopenharmony_ciAC_SUBST(CPUTYPE)
1275159b3361Sopenharmony_ciAC_SUBST(CPUCCODE)
1276159b3361Sopenharmony_ci
1277159b3361Sopenharmony_ciAC_SUBST(CONFIG_DEFS)
1278159b3361Sopenharmony_ci
1279159b3361Sopenharmony_ciAC_CONFIG_FILES([Makefile \
1280159b3361Sopenharmony_ci		 libmp3lame/Makefile \
1281159b3361Sopenharmony_ci		 libmp3lame/i386/Makefile \
1282159b3361Sopenharmony_ci		 libmp3lame/vector/Makefile \
1283159b3361Sopenharmony_ci		 frontend/Makefile \
1284159b3361Sopenharmony_ci		 mpglib/Makefile \
1285159b3361Sopenharmony_ci		 doc/Makefile \
1286159b3361Sopenharmony_ci		 doc/html/Makefile \
1287159b3361Sopenharmony_ci		 doc/man/Makefile \
1288159b3361Sopenharmony_ci		 include/Makefile \
1289159b3361Sopenharmony_ci		 Dll/Makefile \
1290159b3361Sopenharmony_ci		 misc/Makefile \
1291159b3361Sopenharmony_ci		 dshow/Makefile \
1292159b3361Sopenharmony_ci		 ACM/Makefile \
1293159b3361Sopenharmony_ci		 ACM/ADbg/Makefile \
1294159b3361Sopenharmony_ci		 ACM/ddk/Makefile \
1295159b3361Sopenharmony_ci		 ACM/tinyxml/Makefile \
1296159b3361Sopenharmony_ci		 lame.spec \
1297159b3361Sopenharmony_ci		 mac/Makefile \
1298159b3361Sopenharmony_ci		 macosx/Makefile \
1299159b3361Sopenharmony_ci		 macosx/English.lproj/Makefile \
1300159b3361Sopenharmony_ci		 macosx/LAME.xcodeproj/Makefile \
1301159b3361Sopenharmony_ci		 vc_solution/Makefile])
1302159b3361Sopenharmony_ci
1303159b3361Sopenharmony_ciAC_OUTPUT
1304